目前,我正在尝试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
等
有人可以帮助我找到正确的解决方案吗?
您需要排除要重定向到的目标
RedirectMatch 301 /profile/((?!.*/photos).*)$ /profile/$1/photos
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句