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

2019-07-28 06:55发布

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 invoked over and over.

Can anyone point me to a solution ? Thanks

1条回答
时光不老,我们不散
2楼-- · 2019-07-28 07:44

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
查看更多
登录 后发表回答