工作正常,但将www.site.com/robots.txt
重定向到site.com/robots.txt
我尽量避免robots.txt重定向。需要添加什么?
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
答案 0 :(得分:1)
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !robots\.txt
RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]