Monday, June 3, 2013

Apache - Site Maintenance page

Site Under Maintenance Page

In apache config file make sure,
RewriteEngine On

Then add the following lines somewhere (usually within the appropriate virtual host container),

     RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f
     RewriteCond %{REQUEST_FILENAME} !/maintenance.html
     RewriteCond %{REQUEST_FILENAME} !/logo.jpg
     RewriteCond %{REQUEST_FILENAME} !/loading.gif
     RewriteRule ^.*$ /maintenance.html [L]


Then inside the root of the virtual host's directory, add the above files called for your maintenance page. 

When you want to turn the page ON, simply make sure the maintenance.html file is there.

To turn the page OFF, simply rename the maintenance.html file to maintenance.html.REMOVE