0

I was wondering if in the .htaccess file I could have a check to see if a website is down. I found something that will redirect it to the maintenance mode but I don't want to have to go in and add that every time. I have a script that will run and update my live site from a repository. Is there a way to detect this update and automatically put the site in maintenance mode?

#This will redirect the site to maint mode/
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/maint\.html$
RewriteRule ^(.*)$ http://website.com/maint.html [R=307,L]
4

1 回答 1

1

该脚本可以在启动时创建一个文件,您可以在 htaccess 和重定向中检查文件是否存在。脚本完成后 - 它将删除文件。

RewriteCond some_unique_name -f
RewriteCond %{REQUEST_URI} !^/maint\.html$
RewriteRule .* http://website.com/maint.html [R=307,L]

这里不需要括号。

于 2013-07-24T15:06:24.830 回答