本文介绍了htaccess 301 重定向文件夹,但不是子文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要重定向自:
example/folder
到example/newfolder
但是离开:
example/folder/subfolder
它在哪里.这可能吗?我似乎无法在不引起一堆重定向混乱的情况下实现它.
Where it is. Is this possible? I can't seem to make it happen without causing a heap of redirect chaos.
推荐答案我刚刚遇到了这个问题,这是我想出的解决方案.我更喜欢这种方法,因为它不会重定向任何子目录.
I just ran into this and here's the solution I came up with. I prefer this method because it doesn't redirect any subdirectory.
RewriteCond %{REQUEST_URI} ^/root-directory[/]? RewriteCond %{REQUEST_URI} !^/root-directory/+[/]? RewriteRule (.*) www.example/ [R=301,L]更多推荐
htaccess 301 重定向文件夹,但不是子文件夹
发布评论