Recently I was tasked with taking down a website while fixing a few bugs. The trick was figuring out how to show the maintenance page to everyone except myself and the QA team.
The solution I came up with was to use the .htaccess file. Using that one file I was able to make the maintenance page display for all external website visitors while letting myself and the QA team on the website.
Let me explain lines 3,4,5 and 6.
Line 3 – Don’t apply line 6 to the ip address 123.456.789.12
Line 4 – Don’t apply line 6 to the image being used on the maintenance page
Line 5 – Don’t apply line 6 to the maintenance page
Line 6 – Make all requests (except what’s noted above) perform a 302 redirect to the page named maintenance.php
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^123\.456\.789\.12
RewriteCond %{REQUEST_URI} !/images/picture.jpg
RewriteCond %{REQUEST_URI} !/maintenance.php$
RewriteRule $ /maintenance.php [R=302,L]
Leave a Reply