如何使用 htaccess 重定向文件夹的所有地址?
有人可以帮我修改这段代码吗?我不知道如何修改 htaccess。
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule (some_folder/.*) $1 [L] # adjust the regex to what you want.
# normal cake rules
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
我想将所有地址 blog/* 重定向到 blog/
Can some one help me modify this code. I am not sure how to modify htaccess.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule (some_folder/.*) $1 [L] # adjust the regex to what you want.
# normal cake rules
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
I wanna redirect all address blog/* to blog/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能想要:
不过,我不确定您为什么要忽略部分 URL。您想强制将地址设置为 blog/ 而不是透明重定向吗?使用 [R] 而不是 [L]
要覆盖 CakePHP 重定向,您可以尝试
在之前插入:
You probably want:
I'm not sure why you'd want to ignore part of the URL though. Do you want to force the address to blog/ instead of a transparent redirect? Use [R] instead of [L]
To override CakePHP redirects, you could try inserting:
before