【发布时间】:2014-05-17 11:08:28
【问题描述】:
我想将这两个网址 http://example.com/robots.txt 和 http://example.com/sitemap.xml 重定向到 http://www.example.com/robots.txt 和 http://www.example.com/sitemap.xml。
此外,我还将我的 http://example.com 重定向到 http://www.example.com,但站点地图和机器人同时在 url(非 www)和(www)中打开,所以我只希望它只以 www 格式打开。
我尝试使用以下代码
RewriteRule sitemap\.xml http://example.com/sitemap. [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
和
RewriteRule ^sitemap\.xml http://www.example.com/sitemap.xml [L,R=301]
但对我没有用,请帮我解决这个问题。
【问题讨论】:
标签: php xml wordpress .htaccess redirect