Redirect URLs that do not start with specific string

一曲冷凌霜 提交于 2019-12-11 06:19:28

问题


good day everyone, I'm trying to get a redirection work but i keep getting the error "too many redirects"... I want to redirect all the URLs that do not start with a specific strings, I wrote this and many others but didn't work:

RewriteRule !^(?=string1)(?=string2)(?=string3)/(.*) / [R=301,L]

Is there anything wrong? Thanks


回答1:


You need to exclude the homepage in your redirect:

RewriteRule ^(?!string1|string2|string3|$) / [R=301,L]

However, that will not work until you clear your browser cache. When you do that, it will stop redirecting too many times.



来源:https://stackoverflow.com/questions/51170921/redirect-urls-that-do-not-start-with-specific-string

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!