Redirect visitors to maintenance page

Redirect visitors to maintenance page

We often change our WordPress theme. When changing the themes, normally the visitors encounter with strange errors. At this situation, we have to redirect the visitors to a maintenance web page except for the admin.

In the snippet below, change your maintenance page name and on REMOTE_ADDR type in your IP. Make sure that you have a static IP before trying this hack.

RewriteEngine on

RewriteCond %{REQUEST_URI} !/maintenance.html$

RewriteCond %{REMOTE_ADDR} !^123.123.123.123

RewriteRule $ /maintenance.html [R=302,L]