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

查看:27
本文介绍了.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天全站免登陆