Skip to content

Instantly share code, notes, and snippets.

@wdalmut
Created July 9, 2012 08:14
Show Gist options
  • Save wdalmut/3075015 to your computer and use it in GitHub Desktop.
Save wdalmut/3075015 to your computer and use it in GitHub Desktop.
Maintenance with .htaccess
RewriteEngine On
RewriteCond %{REQUEST_URI} !\.(css|jpg|png)$
RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1$
RewriteCond %{REMOTE_ADDR} !^10\.64\.98\.201$
#RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
#RewriteRule ^.*$ /system/maintenance.html [L]
RewriteRule ^.*$ /maintenance.html [L]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
<title>System down for maintenance</title>
<style type="text/css">
div.outer {
position: absolute;
left: 50%;
top: 50%;
width: 500px;
height: 300px;
margin-left: -260px;
margin-top: -150px;
}
.DialogBody {
margin: 0;
padding: 10px;
text-align: left;
border: 1px solid #ccc;
border-right: 1px solid #999;
border-bottom: 1px solid #999;
background-color: #fff;
}
body { background-color: #fff; }
</style>
</head>
<body>
<div class="outer">
<div class="DialogBody" style="text-align: center;">
<div style="text-align: center; width: 200px; margin: 0 auto;">
<p style="color: red; font-size: 16px; line-height: 20px;">
The system is down for maintenance.
</p>
<p style="color: #666;">
It'll be back shortly.
</p>
</div>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment