How-To: Redirect all requests to maintenance page with mod_rewrite
Jul.17, 2008 in
Development, How To
A common requirement when performing maintenance on your website is to redirect all requests to a downtime message. This can be very easily achieve using mod_rewrite and a .htaccess file. Simply create an .htaccess file with the following commands:
RewriteEngine On RewriteRule !^site-down\.html$ /site-down.html [L]
This will redirect all requests to the site-down.html file. Once your maintenance period is over, remove the commands above (or comment them out with a # character) and you are back up and running.
Tags: apache, mod_rewrite







Leave a Reply