I am trying to take my site offline for maintenance but only allow access to my IP address. However I can only ever manage to produce an internal server error. I don't understand how it exactly what i've done wrong. I want normal people to get my maintenance.php and for me to get the normal WordPress redirect rules and pages.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^maintenance\.php$ - [L] # Direct requests to maintenance.php should show file and stop
#RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC] # Give access to images on maintenance page
#RewriteCond %{REMOTE_ADDR} !^xxx\.xxx\.xxx\.xxx # My IP goes here
RewriteRule . /maintenance.php [R=302,L]

# Normal WordPress rules
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
  • I've just asked - and answered - a similar kind of question myself here: webmasters.stackexchange.com/questions/26181 It wasn't WordPress specific, but then, does it have to be?
    – turbonerd
    Feb 20, 2012 at 14:20
  • You should put your rules in their own block. WordPress gets funny about sharing its space with others. I had to diagnose a client's site where their permalinks would not work. Once I moved their custom rules to a separate block, the permalinks started working again. Strange but true. Feb 20, 2012 at 14:57
  • Looks like you're adding an extra slash in with your rewrite. Try adding RewriteBase / to the beginning of your rewrite rules, or changing the last line to RewriteRule . maintenance.php [R=302,L]. Otherwise, you're changing all your requests to //maintenance.php, a url that doesn't resolve anywhere. Feb 20, 2012 at 16:26

1 Answer 1


what about a plugin like maintenance mode? http://wordpress.org/extend/plugins/maintenance-mode/

only allows access by logged in users

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.