[英]htaccess redirect not working in same domain
I want to redirect https://xxx.xxxx.com/zzz
to https://xxx.xxxx.com/zzz247
. 我想将
https://xxx.xxxx.com/zzz
重定向到https://xxx.xxxx.com/zzz247
。 I have tried this 我试过这个
Redirect 301 / https://xxx.xxxx.com/zzz247
So now when I try https://xxx.xxxx.com/zzz
its take me into https://xxx.xxxx.com/zzz247zzz247zzz247zzz247zzz247zzz247zzz247....
所以,现在当我尝试
https://xxx.xxxx.com/zzz
时, https://xxx.xxxx.com/zzz
带我进入https://xxx.xxxx.com/zzz247zzz247zzz247zzz247zzz247zzz247zzz247....
How can I fix this issue? 我该如何解决这个问题? help please
请帮助
What is required 需要什么
I need enable only one URL which is https://xxx.xxxx.com/zzz247
even user type https://xxx.xxxx.com/zzz
我只需启用一个URL,即
https://xxx.xxxx.com/zzz247
即使是用户类型https://xxx.xxxx.com/zzz
Instead of Redirect
directive use RedirectMatch
with regex support: 而不是
Redirect
指令使用RedirectMatch
和正则表达式支持:
RedirectMatch 301 ^/zzz/?$ /zzz247
Redirect
appends current URI into redirected URI and since you're matching /
that will match anything and cause a redirect loop. Redirect
将当前URI附加到重定向的URI中,因为您匹配/
将匹配任何内容并导致重定向循环。
Make sure to clear your browser cache before testing. 确保在测试前清除浏览器缓存。
Using RewriteRule
you can do this: 使用
RewriteRule
可以执行以下操作:
RewriteRule ^zzz/?$ /zzz247? [L,NC,R=301]
?
at the end of the target URI is for stripping any query string. 在目标URI的末尾用于剥离任何查询字符串。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.