WordPress doesn’t have a maintenance mode. This makes me sad. Luckily, I have a quick fix.

First, you’ll need to create a new directory and a temporary “Maintenance” page. For this example, let’s call it /maintenance/index.html. Fill the Maintenance page with anything you want.

Next, pop open your root .htaccess file. Add this line to the absolute top of the file (before the WP code);

RewriteEngine on
RewriteCond %{REQUEST_URI} !/maintenance/$ 
RewriteCond %{REMOTE_HOST} !^1.2.3.4
RewriteRule $ /maintenance/ [R=302,L]

What this does (in Pseudo-Code):
If your ip address is 1.2.3.4 then process the WordPress request normally.
If you’re not already on /maintenance/ and your ip address is not 1.2.3.4, then stop processing and do a temporary redirect to /maintenance/

When you do this, only requests from the specified ip address can see the WordPress site. Make sure to remove this code from the .htaccess when you are finished with your changes.

Leave a Reply

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