开发者

.htaccess redirect permanent www.domain.com/A to www.domain.com/A/B

开发者 https://www.devze.com 2023-02-11 04:59 出处:网络
A is an empty folder, simply used for building up my hierarchy of pages. It contains B,C which are also folders (non empty)

A is an empty folder, simply used for building up my hierarchy of pages. It contains B,C which are also folders (non empty)

The hierarchy comes from the Apostrophe CMS.

The following rule does not work in .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 invoke开发者_JAVA百科d over and over.

Can anyone point me to a solution ? Thanks


Try using RedirectMatch and include the "end of string" $ in the regex.

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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号