.htaccess重定向除主页以外的所有页面 [英] .htaccess redirect all pages except the home page

查看:147
本文介绍了.htaccess重定向除主页以外的所有页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚合并了两个网站。站点A现在已与站点B合并。

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

站点A具有一个.htaccess文件,该文件将所有内容重定向到承载站点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]

工作正常,但是,我需要站点A的主页不要重定向。

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?

推荐答案

。* 更改为。+ ,以确保您的正则表达式模式与目标网页无关:

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

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

这篇关于.htaccess重定向除主页以外的所有页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆