Putting site temporarily down and redirecting users to a maintenance page.

Today I needed this trick. I was having some problem with one of my sites. I want to turn the site down while I am fixing it. But as the site is made with scatter html, php pages, it is not easy to centrally control maintenance mode. But I believed, this is possible by .htaccess trick. After searching a lot I have found a wonderful tutorial for it.

Here is the link of the tip/tutorial.

The tutorial is very easy to understand. If you understand .htaccess then here is the main part.

order deny,allow
deny from all
allow from 123.456.789
ErrorDocument 403 /custom-message.html
<Files custom-message.html>
order allow,deny
allow from all

It first deny all IPs’ access to the site (3rd line) then only allow the webmaster (4th line, you must put your own IP). At 6th line, we mention custom Forbidden (403) page. But it is worthless as we already denied all users (IPs) to all pages. So in next lines we exclusively allow all to our custom 403 page so that they can see only that page.

Hope it will help you like me :).