问题
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]
回答1:
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.
回答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]
来源:https://stackoverflow.com/questions/8602399/allow-multiple-ips-to-access-wordpress-site-admin-via-htaccess