3

I currently have a wordpress site that is being upgraded and I have a maintenence redirect setup in the .htaccess file.

I can allow my own IP access the site and admin but how can I allow multiple IPs access for the other editors to also have access.

I'm currently using :

     
     RewriteEngine on
     RewriteCond %{REMOTE_HOST} !^123.456.789.101
     #RewriteCond %{REMOTE_ADDR} !^123.456.789.101
     RewriteCond %{REQUEST_URI} !/maintanence.html$ [NC]
     RewriteCond %{REQUEST_URI} !.(jpe?g?|png|gif) [NC]
     RewriteRule .* /maintanence.html [R=302,L]
    
    
areid
  • 283
  • 2
  • 5
  • 14

2 Answers2

5

The answer might be a bit late but:

 RewriteCond %{REMOTE_HOST} !(123\.456\.789\.101|123\.456\.789\.102|123\.456\.789\.103)

works well.

Hiram
  • 51
  • 1
  • 1
2

Well you wanted IPs not hosts, so make sure to do that. Then chain them together using your intended logic:

RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1$
RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.2$
RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.3$
RewriteRule .* /maintenance.html [R=302,L]
  • 3
    That will never work because RewriteCond's are inherently **AND**'ed, you'd need to put an `[OR]` between them. – Jon Lin Dec 22 '11 at 22:15