目前,我正试图在我的htaccess文件中编写一个301 RedirectMatch
。但是,在我重定向到的url上也会触发匹配的url,从而导致无限循环。
当我的url以/profile/herman-visser
结尾时,我想重定向到/profile/herman-visser/photos
。我使用的规则如下:
RedirectMatch 301 /profile/(.*) /profile/$1/photos
然而,当我要去/profile/herman-visser/photos
时,这个规则也会被触发,从而导致/photos/photos/photos/photos
等。
有人能帮我找到正确的解决方案吗?
发布于 2019-03-12 06:35:13
您需要排除要重定向到的目的地。
RedirectMatch 301 /profile/((?!.*/photos).*)$ /profile/$1/photos
https://stackoverflow.com/questions/55123775
复制相似问题