Last Updated: February 25, 2016
· jasny

Taking your website offline for maintenance

I’ve seen a lot of methods used to take a website temporarily off-line for maintenance. Most involve a using PHP to disable the site or renaming the index file. There is however a far better method of doing this, by placing the following in the virtual host or in an .htaccess:

Header always set Retry-After "Thu, 12 Dec 2014 23:00:00 +0200"
Redirect 503 /

This way you are sure no part of the site is used. Also by returning a 503 http response, search-engine crawlers will not reindex your site right at the moment it is down. You can use ‘ErrorDocument’ to place a different text than the apache default.

1 Response
Add your response

Nice, thanks for this! I'll have a need for it before the year is out.

over 1 year ago ·