.htaccess redirect all pages except the home page

孤街浪徒 提交于 2019-12-11 05:12:52

问题


I have just merged two websites. Site A is now merged with site B.

Site A has got a .htaccess file which redirects all of the content to the new domain where site B is hosted.

RewriteRule (.*) http://www.siteb.com/$1 [R=301,L]

It is working perfectly, however, I need the homepage of site A not to redirect.

What do I need to add to the code above to make that happen?


回答1:


Just change .* to .+ to make sure your regex pattern isn't matcinng landing page:

RewriteRule (.+) http://www.siteb.com/$1 [R=301,L,NE]


来源:https://stackoverflow.com/questions/38594507/htaccess-redirect-all-pages-except-the-home-page

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