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
.htaccess 通过htaccess重定向整个子目录_.htaccess - Fatal编程技术网

.htaccess 通过htaccess重定向整个子目录

.htaccess 通过htaccess重定向整个子目录,.htaccess,.htaccess,我需要暂时关闭一个web子目录及其所有子目录,而不从服务器上实际删除文件。我想重定向任何人和每个人到一个特定的网页,如果他们试图击中任何网页内的子目录或其子目录。我希望重定向到子目录中存储的页面,因为它的css和所有图像都位于子目录中 我正在尝试这些指令,但没有成功: Options -ExecCGI -Indexes DirectoryIndex /sub-dir/interim.php Options +FollowSymLinks RewriteEngine on RewriteCond

我需要暂时关闭一个web子目录及其所有子目录,而不从服务器上实际删除文件。我想重定向任何人和每个人到一个特定的网页,如果他们试图击中任何网页内的子目录或其子目录。我希望重定向到子目录中存储的页面,因为它的css和所有图像都位于子目录中

我正在尝试这些指令,但没有成功:

Options -ExecCGI -Indexes
DirectoryIndex /sub-dir/interim.php
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !interim.php
RewriteRule ^(.*)$ /sub-dir/interim.php [L,NC,QSA]

有人做过这样的事吗?

听起来可能会产生某种永无止境的循环。能否重定向到指向同一目录的其他域?或者添加指向您的站点的新子域,如offline.example.com。您可以使用RedirectMatch匹配任何请求,并指定临时http状态,以便客户端知道重定向是临时的

RedirectMatch temp (.*) http://offline.example.com/interim.php

谢谢我想我只是想暂时删除服务器上的目录。要“聪明”地对待这件事要花很长时间。