.htaccess 如何使用htaccess设置整个网站的维护模式

.htaccess 如何使用htaccess设置整个网站的维护模式,.htaccess,offline,maintenance,.htaccess,Offline,Maintenance,我发现了htaccess禁用整个网站的代码(用于维护模式): 现在,在我的offline.php页面中,我有一个指向css和js文件的链接,如: <link rel="stylesheet" href="include/css/error.css"> <script src="include/js/file.js"></script> 当我使用上面的代码设置维护模式时,会加载offline.php页面,但是如果没有css和js,我如何允许加载这两个文件

我发现了htaccess禁用整个网站的代码(用于维护模式):

现在,在我的offline.php页面中,我有一个指向css和js文件的链接,如:

<link rel="stylesheet" href="include/css/error.css">
<script src="include/js/file.js"></script>

当我使用上面的代码设置维护模式时,会加载offline.php页面,但是如果没有css和js,我如何允许加载这两个文件


我认为对除我的ip之外的所有人禁用网站都很有用,这样我可以更新网站,这可能吗?

我找到了一个包含你问题答案的博客,请查看此博客

以下示例取自上述指定场地

如果您的根目录中没有.htaccess文件 域,创建一个并添加以下代码。如果你已经有了 .htaccess文件,将以下代码添加到 可能在里面


我找到了一个博客,里面有你问题的答案,请检查这个

以下示例取自上述指定场地

如果您的根目录中没有.htaccess文件 域,创建一个并添加以下代码。如果你已经有了 .htaccess文件,将以下代码添加到 可能在里面


这是一个很好的答案,但下面是它的代码,以防链接死掉:

RewriteEngine On

# Add all the IP addresses of people that are helping in development
# and need to be able to get past the maintenance mode.
# One might call this the 'allow people list'
RewriteCond %{REMOTE_HOST} !^83\.101\.79\.62
RewriteCond %{REMOTE_HOST} !^91\.181\.207\.191

# Make sure the maintenance mode only applies to this domain
# Example: I am hosting different sites on my server
# which could be affected by these rules.
RewriteCond %{HTTP_HOST} ^nocreativity.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.nocreativity.com$

# This is the 'ignore file list'. It allows access to all
# files that are needed to display the maintenance mode page.
# Example: pages, css files, js files, images, anything.
# IMPORTANT: If you don't do this properly, visitors will end up with
# endless redirect loops in their browser.
RewriteCond %{REQUEST_URI} !/offline\.htm$
RewriteCond %{REQUEST_URI} !/css\/style\.css$
RewriteCond %{REQUEST_URI} !/images\/logo\.png$

# Rewrite whatever request is coming in to the maintenance mode page
# The R=302 tells browsers (and search engines) that this
# redirect is only temporarily.
# L stops any other rules below this from executing whenever somebody is redirected.
RewriteRule \.*$ /offline.htm [R=302,L]

这是一个很好的答案,但下面是它的代码,以防链接死掉:

RewriteEngine On

# Add all the IP addresses of people that are helping in development
# and need to be able to get past the maintenance mode.
# One might call this the 'allow people list'
RewriteCond %{REMOTE_HOST} !^83\.101\.79\.62
RewriteCond %{REMOTE_HOST} !^91\.181\.207\.191

# Make sure the maintenance mode only applies to this domain
# Example: I am hosting different sites on my server
# which could be affected by these rules.
RewriteCond %{HTTP_HOST} ^nocreativity.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.nocreativity.com$

# This is the 'ignore file list'. It allows access to all
# files that are needed to display the maintenance mode page.
# Example: pages, css files, js files, images, anything.
# IMPORTANT: If you don't do this properly, visitors will end up with
# endless redirect loops in their browser.
RewriteCond %{REQUEST_URI} !/offline\.htm$
RewriteCond %{REQUEST_URI} !/css\/style\.css$
RewriteCond %{REQUEST_URI} !/images\/logo\.png$

# Rewrite whatever request is coming in to the maintenance mode page
# The R=302 tells browsers (and search engines) that this
# redirect is only temporarily.
# L stops any other rules below this from executing whenever somebody is redirected.
RewriteRule \.*$ /offline.htm [R=302,L]

步骤1:在根目录中创建文件“.maintence”,如.htaccess

步骤2:将此代码放入文件中

  <?php $upgrading = time();?>

步骤3:保存文件。然后您可以看到默认维护消息“暂时不可用于计划维护”。请稍后再查

如果您想拥有自己的警告信息,请执行以下操作:


创建一个“maintenance.php”文件并将其放在wp内容目录中,wordpress使用此文件在您设置的任何强制维护期间显示。

步骤1:在根目录中创建一个文件“.maintence”,如.htaccess

步骤2:将此代码放入文件中

  <?php $upgrading = time();?>

步骤3:保存文件。然后您可以看到默认维护消息“暂时不可用于计划维护”。请稍后再查

如果您想拥有自己的警告信息,请执行以下操作:

创建一个“maintenance.php”文件并将其放在wp内容目录中,wordpress使用该文件在您设置的任何强制维护期间显示