November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

TEMPORARY “SITE DOWN” NOTICE IN APACHE Linux Web

“Site down for maintenance” notice using Apache .htaccess and the mod_rewrite module.
I assume you know how to enable the Apache htaccess directive and the mod_rewrite module.

First you need to create a .htaccess file in your root level of your website.
Next you add the following lines to it

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !/sitedown.html$
RewriteRule $ /sitedown.html [R=302,L]
The .htaccess file should be “active” immediately and you should see the content of your sitedown.html file. If not, try clearing your browsers cache.

If you as a maintenance user would like to access the site without seeing the sitedown.html file, add the following line to enable IP address exception

RewriteCond %{REMOTE_HOST} !^192\.168\.0\.12

Remember to replace the IP address with your address.

The .htaccess file should now look something like this.

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !/sitedown.html$
RewriteCond %{REMOTE_HOST} !^192\.168\.0\.12
RewriteRule $ /sitedown.html [R=302,L]
Just delete the .htaccess file when you are done with your maintenance and your site will be available again.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>