我正在尝试这样做......
将www.mysite.com/directory/*
重定向到我的subdommain.mysite.com/directory/*
请帮帮我
RewriteCond %{HTTP_HOST} ^www\.mysite\.com$ [NC]
RewriteRule ^directory/(.*)$ http://subdommain.mysite.com/directory/$1 [R=301,L]
我想要它
答案 0 :(得分:1)
如果您要将所有请求从www.mysite.com
重定向到subdomain.mysite.com
,请尝试将其添加到.htaccess文件中:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.mysite\.com$ [NC]
RewriteRule ^(.*)$ http://subdomain.mysite.com/$1 [R=301,L]
如果您只想将/anydirectory/
的请求从www.mysite.com/anydirectory/
重定向到subdomain.mysite.com/anyotherdirectory/
,请尝试将其添加到.htaccess文件中:
RewriteCond %{HTTP_HOST} ^www\.mysite\.com$ [NC]
RewriteRule ^anydirectory/(.*)$ http://subdommain.mysite.com/anyotherdirectory/$1 [R=301,L]