• Skip to primary navigation
  • Skip to main content

Rick R. Duncan

There's no adventure without the risk of failure.

  • Work Hours
  • After Hours
  • About
    • Resume
  • Contact

Maintenance Page in Php

October 19, 2022 by Rick R. Duncan Leave a Comment

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]

Filed Under: WordPress & Web Development

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Copyright © 2009–2023 Rick R. Duncan