Ok, so you have to bring the s …

Ok, so you have to bring the site down for maintenance, and display a nice “closed” sign on the site to visitors.
Using Apache this is easy.
1. Create a directory, maintenance in the document root of the web server. Inside there put a .htaccess file with the following:

<limit GET POST>
order allow,deny
allow from all

Create an index.html in this directory with whatever message you want to display to the user.

2. Create a .htaccess file in the document root of your server:

<limit GET POST>
order deny,allow
deny from all
allow from MYIPADDRESS

Change MYIPADDRESS to the IP of the machine you access your site from.

3. Add the following to your httpd.conf, preferably in the virtual host of the server you’re taking down:

ErrorDocument 403 /maintenance/index.html

While you’re there, put the same in for 404 too.

Restart Apache and voila! You’re site is now under maintenance! Don’t forget to undo the above when you want visitors to get into the site!

By Donncha

Donncha Ó Caoimh is a software developer at Automattic and WordPress plugin developer. He posts photos at In Photos and can also be found on Twitter.

Leave a Reply