htaccess rewrite migrate different domain

…衆ロ難τιáo~ 提交于 2019-12-13 02:59:48

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!