问题
How do I change the base domain of an incoming link using htaccess module rewrite?
Incoming url:
www.foo.com/bar?name1=value1&name2=value2
Rewritten url:
www.newFoo.com/bar?name1=value1&name2=value2
Apache webserver should simply rewrite all of its incoming urls, on the webserver itself no websites are saved anymore.
回答1:
Add this to your .htaccess
in your web root /
directory of the server hosting www.foo.com
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?foo\.com$ [NC]
RewriteRule ^(.*)$ http://www.newfoo.com/$1 [R=301,L]
来源:https://stackoverflow.com/questions/18293284/htaccess-rewrite-migrate-different-domain