如何将流量从www.old.com
重定向到www.new.com
,但
www.old.com/hello
至www.new.com/byebye
www.old.com/test?start=5
至www.new.com/page/site
我从头开始:
RewriteEngine On
RewriteBase /
# root
RewriteCond %{HTTP_HOST} ^www\.(([^\.]+))\.pl [NC]
RewriteRule ^(.*)$ http://%1.pl%{REQUEST_URI} [R=301,L]
# Redirect
Redirect permanent old.com/hello new.com/byebye
答案 0 :(得分:0)
您可以使用此.htaccess:
RewriteEngine On
RewriteBase /
# redirect
RewriteCond %{HTTP_HOST} ^www\.old\.com$ [NC]
RewriteRule ^hello$ http://www.new.com/byebye [NC,R=301,L]
RewriteCond %{HTTP_HOST} ^www\.old\.com$ [NC]
RewriteCond %{QUERY_STRING} ^start=5$ [NC]
RewriteRule ^test$ http://www.new.com/page/site? [NC,R=301,L]
# root
RewriteCond %{HTTP_HOST} ^www\.([^.]+)\.pl [NC]
RewriteRule ^ http://%1.pl%{REQUEST_URI} [R=301,L]