Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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]
</IfModule>
share|improve this question
    
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? –  dunc Feb 20 '12 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. –  Joseph Feb 20 '12 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. –  goldenapples Feb 20 '12 at 16:26
add comment

1 Answer

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

only allows access by logged in users

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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