Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.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/5/reporting-services/3.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 - Fatal编程技术网

.htaccess 将域下的所有请求重定向到正在构造的文件夹

.htaccess 将域下的所有请求重定向到正在构造的文件夹,.htaccess,.htaccess,我一直在尝试将域下的所有请求重定向到具有以下内容的欠构造文件夹: RewriteEngine On RewriteCond %{REQUEST_URI} !=/underconstruction/ RewriteRule ^ /underconstruction/ [R=301] 但它似乎不起作用 我试过这个(而且很有效): 但我看不到它附带的图像和CSS 有人知道吗?也许一种解决方案是将所有图像和CSS文件从规则中排除,如下所示: Options +FollowSymlinks -M

我一直在尝试将域下的所有请求重定向到具有以下内容的欠构造文件夹:

 RewriteEngine On
 RewriteCond %{REQUEST_URI} !=/underconstruction/
 RewriteRule ^ /underconstruction/ [R=301] 
但它似乎不起作用

我试过这个(而且很有效):

但我看不到它附带的图像和CSS


有人知道吗?

也许一种解决方案是将所有图像和CSS文件从规则中排除,如下所示:

Options +FollowSymlinks -MultiViews
RewriteEngine On
# Add or remove file types in the next line if necessary.
RewriteCond %{REQUEST_URI} !\.(css|jpg|png|gif|bmp|js)  [NC]
RewriteCond %{REQUEST_URI} !underconstruction\.html  [NC]
RewriteRule .*   /underconstruction/underconstruction.html [R=302,L]

其他选项是将指向这些文件的链接中的相对路径替换为绝对路径,或使用此

中所述的基本元素。规则起作用,但页面显示不正确,是吗?是的,页面显示,但css和图像不会将css和图像链接到正确的完整路径。(例如)不要忘记.js文件是的。说得好。谢谢,非常感谢!,这是十分之十的帮助你太棒了谢谢
Options +FollowSymlinks -MultiViews
RewriteEngine On
# Add or remove file types in the next line if necessary.
RewriteCond %{REQUEST_URI} !\.(css|jpg|png|gif|bmp|js)  [NC]
RewriteCond %{REQUEST_URI} !underconstruction\.html  [NC]
RewriteRule .*   /underconstruction/underconstruction.html [R=302,L]