How To Make A 503 Service Unavailable Page
It’s inevitable — at some point your site WILL go down. Ideally, the reason will be one of your choosing — you’re performing some sort of maintenance on it or adding some super-functional feature that will distance you even further from the competition. More likely, though, your site will go down because of server issues, heavy traffic, or even a hack or virus. And, when that happens, you don’t want Google’s search engine spiders coming around and crawling your site while it’s not looking its best.
That’s why you need to know how to put an Error 503 page up. The purpose isn’t really to tell users that your site is temporarily unavailable; instead, it’s to tell search engines to come back later. It’s especially helpful if your site relies on your SEO skills to get found — if Google comes by and finds it riddled with spammy links due to an attack from the Gumblar virus, it may de-list your site, thinking it’s an entire page of spam. It’s best, then, to bar access to it temporarily while you get the problem sorted out.
PHP Code — maintenance.php
This code snippet simply sends a message to the interwebs that your site is down for the moment, but will return to full functionality shortly. Create the PHP file as follows:
Then, you’ll want to use an Apache mod_rewrite (aka .htaccess) module to ensure that all requests for your page see the message. The first mod makes sure everyone gets redirected to the error 503 message, while the second allows your IP address (or the site admin’s) access to the page to work on it.