[英].htaccess redirect permanent www.domain.com/A to www.domain.com/A/B
A is an empty folder, simply used for building up my hierarchy of pages. A是一个空文件夹,仅用于构建我的页面层次结构。 It contains B,C which are also folders (non empty)
它包含B,C,它们也是文件夹(非空)
The hierarchy comes from the Apostrophe CMS . 层次结构来自Apostrophe CMS 。
The following rule does not work in .htaccess: 以下规则在.htaccess中不起作用:
Redirect permanent /A http://www.domain.com/A/B
because it ends up to : http://www.domain.com/A/B/B/B/B etc since the rule is invoked over and over. 因为该规则以一遍又一遍的方式被调用,所以最终以: http : //www.domain.com/A/B/B/B/B等结尾。
Can anyone point me to a solution ? 谁能指出我的解决方案? Thanks
谢谢
Try using RedirectMatch and include the "end of string" $ in the regex. 尝试使用RedirectMatch,并在正则表达式中包含“字符串结尾” $。
RedirectMatch permanent /A$ http://www.domain.com/A/B
RedirectMatch permanent /A/$ http://www.domain.com/A/B
EDIT: The below matches may work somewhat better (at all) 编辑:以下比赛可能会更好一些(全部)
RedirectMatch permanent .*/A$ http://www.domain.com/A/B
RedirectMatch permanent .*/A/$ http://www.domain.com/A/B
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.