.htaccess redirect to maintenance – under construction page
Posted by: Tim on
Jan 17th, 2011 |
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