.htaccess domain redirect

别说谁变了你拦得住时间么 提交于 2019-12-31 03:55:05

问题


I have a server which has 3 domains all pointing to it. All domains are on the same website.

www.domain1.com
www.domain2.com
www.domain3.com

How can I redirect www.domain3.com to www.domain3.com/test.html using .htaccess?

Thanks!


回答1:


In your .htaccess, put:

RewriteEngine On
RewriteCond %{http_host} ^www\.domain3\.com [NC]
RewriteRule ^(.*)$ http://www.domain3.com/test.html [R=301,NC]

That should do it.




回答2:


In your domain3's .htaccess, put:

RedirectPermanent / http://www.domain2.com/test.html


来源:https://stackoverflow.com/questions/3374330/htaccess-domain-redirect

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