Htaccess Maintenance Redirect

Last modified: 
Friday, March 27th, 2015

Overview

This is a snippet taken from here: http://perishablepress.com/press/2010/05/19/htaccess-redirect-maintenanc...

It will redirect all incoming requests to ''/maintenance.html'' if the requests do not originate from the IP Address ''123.456.789.000'' (which you would replace with your own IP address).

Snippet

# MAINTENANCE-PAGE REDIRECT

 RewriteEngine on
 RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.000
 RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC]
 RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
 RewriteRule .* /maintenance.html [R=302,L]


The operator of this site makes no claims, promises, or guarantees of the accuracy, completeness, originality, uniqueness, or even general adequacy of the contents herein and expressly disclaims liability for errors and omissions in the contents of this website.