Home / Software / Apache / How do I turn off my website for maintenance?
How do I turn off my website for maintenance?
Last updated: 06/24/2009
To redirect all requests for your site to a "maintenance" url, use mod_rewrite. I also found this useful when migrating a site to another server, so people hitting the old site don't add / modify any content.
In your document root, create a file called .htaccess (notice the .) , and add these lines:
RewriteEngine On RewriteRule ^(.*) down.html [L]
Now, you'll need to create a file called "down.html" with just some plain html in it to notify users that the site is not available. Note - don't reference any images, or other server files, or those requests will also get rewritten, causing an ugly mess.