Shared Know How


Howto: fix, find, use, make & do it guide

.htaccess redirect to maintenance – under construction page

author Posted by: Tim on date Jan 17th, 2011 | filed Filed under: Other stuff

For simple redirect while doing maintenance on websites like upgrades or emergency fixes I put a site in maintenance by adding the next few lines to my .htacces

RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123
RewriteCond %{REQUEST_URI} !(\.(gif|jpg|css)$|^/maintenance\.html$)
RewriteRule ^(.*)$ /maintenance.html [R=302,L]

Ofcourse change the 123\.123\.123\.123 to your ip address and create a maintenance.html. This .htaccess will still serve images and css normally so you can use them in your maintenance page.

If you want to add more ip adresses just duplicate the line: RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123 and change the ip.

Did this help you? Wanna help too?

     Add A Comment

trackback Trackback URI | rsscomment Comments RSS