Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess 将整个文件夹重定向到根目录_.htaccess_Mod Rewrite_Url Rewriting_Url Redirection - Fatal编程技术网

.htaccess 将整个文件夹重定向到根目录

.htaccess 将整个文件夹重定向到根目录,.htaccess,mod-rewrite,url-rewriting,url-redirection,.htaccess,Mod Rewrite,Url Rewriting,Url Redirection,我到处找了,找不到解决办法 我想将几个文件夹(及其所有内容,包括子文件夹)重定向到网站的根目录 应该发生什么的示例: http://www.domain.com/folder/ -> http://www.domain.com/ http://www.domain.com/folder/subfolder/ -> http://www.domain.com/ http://www.domain.com/folder/ -> http://www.domain.com/ (wo

我到处找了,找不到解决办法

我想将几个文件夹(及其所有内容,包括子文件夹)重定向到网站的根目录

应该发生什么的示例

http://www.domain.com/folder/ -> http://www.domain.com/
http://www.domain.com/folder/subfolder/ -> http://www.domain.com/
http://www.domain.com/folder/ -> http://www.domain.com/ (works!)
http://www.domain.com/folder/subfolder/ -> http://www.domain.com/subfolder/ (doesn't work!)
现在发生的事情的示例

http://www.domain.com/folder/ -> http://www.domain.com/
http://www.domain.com/folder/subfolder/ -> http://www.domain.com/
http://www.domain.com/folder/ -> http://www.domain.com/ (works!)
http://www.domain.com/folder/subfolder/ -> http://www.domain.com/subfolder/ (doesn't work!)
怎么了

RewriteEngine On
RewriteRule ^folder/(.*)$ http://www.domain.com/ [R=301,NC,L]