我在尝试301重定向
http://www.domain.com/page.html
至
http://subdomain.domain.com/page.html
并尝试:
redirect 301 /page.html http://subdomain.domain.com/page.html问题是域和子域都指向相同的dir,这使得重定向的方式永远不会完成。
也曾尝试但未获成功:
RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^page\.html$ "http\:\/\/subdomain\.domain\.com\/page\.html" [R=301,L]发布于 2011-06-01 06:58:26
好吧.我想出来了--第二种情况--只需要放在RewriteEngine之后就行了:
RewriteCond %{HTTP_HOST} ^domain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.com$
RewriteRule ^page.html$ http://subdomain.domain.com/page.html [R=301,L]在一个条件下,这可以用于多个规则:
RewriteCond %{HTTP_HOST} !^(www\.)?domain.com$ [NC]
RewriteRule .* - [S=2]
RewriteRule ^page.html$ http://subdomain.domain.com/page.html [R=301,L]
RewriteRule ^page-2.html$ http://subdomain.domain.com/page-2.html [R=301,L]https://stackoverflow.com/questions/6192863
复制相似问题