我的.htaccess
文件如下所示:
`<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC]
RewriteCond %{REQUEST_URI} !.(jpe?g?|png|gif) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /maintenance.html [R=302,L]
</IfModule>`
但是我的任何.htm/.html
页面似乎都没有发生重定向
删除RewriteCond %{REQUEST_FILENAME} !-f
,因为它会阻止任何受影响的现有文件。
RewriteEngine on
RewriteCond %{REQUEST_URI} !.(jpe?g?|png|gif|CSS|js)$ [NC]
RewriteRule !^maintenance.html$ /maintenance.html [NC,R=302,L]
确保这是根 .htaccess 中的第一条规则