htaccess的301重定向文件夹,而不是子文件夹 [英] htaccess 301 redirect folder, but not subfolders
本文介绍了htaccess的301重定向文件夹,而不是子文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要从重定向:
但留下:
http://mysite.com/folder/subfolder
在哪里。这可能吗?我似乎无法做到这一点,而不会导致重定向乱的堆。
Where it is. Is this possible? I can't seem to make it happen without causing a heap of redirect chaos.
在此先感谢。
推荐答案
我只是碰到了这一点,这是我想出了一个解决方案。我preFER这种方法,因为它不重定向任何子目录。
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 (.*) http://www.newdomain.com/ [R=301,L]
这篇关于htaccess的301重定向文件夹,而不是子文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文