为最后一部分配置RedirectMatch,而没有无限循环

赫尔曼

目前,我正在尝试RedirectMatch在htaccess文件中写入301 但是,匹配的URL也会在我重定向到的URL上触发,从而导致无限循环。

当我的网址以结尾时,/profile/herman-visser我想重定向到/profile/herman-visser/photos我正在使用以下规则:

RedirectMatch 301 /profile/(.*) /profile/$1/photos

但是,这是工作的时候,我要去/profile/herman-visser/photos的规则也引发产生/photos/photos/photos/photos

有人可以帮助我找到正确的解决方案吗?

阿米特·维玛(Amit Verma)

您需要排除要重定向到的目标

RedirectMatch 301 /profile/((?!.*/photos).*)$ /profile/$1/photos

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章