Skip to main content
added 9 characters in body
Source Link
cybmeta
  • 20.6k
  • 5
  • 47
  • 56

Set the rules above the WordPress default rules and use the [OR] operator/[AND] operators to concatenate RewriteRules (by default [AND] operator is used):

RewriteCond %{REMOTE_ADDR} !^11\.111\.111\.111 [OR]
RewriteCond %{REMOTE_ADDR} !^22\.222\.222\.222 [AND]
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteRule ^(.*)$ http://domain.com/maintenance.html [R=502,L]

PD: correct status code for maintenance mode is 502, not 307.

Set the rules above the WordPress default rules and use the [OR] operator to concatenate RewriteRules (by default [AND] operator is used):

RewriteCond %{REMOTE_ADDR} !^11\.111\.111\.111 [OR]
RewriteCond %{REMOTE_ADDR} !^22\.222\.222\.222 [AND]
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteRule ^(.*)$ http://domain.com/maintenance.html [R=502,L]

PD: correct status code for maintenance mode is 502, not 307.

Set the rules above the WordPress rules and use the [OR]/[AND] operators to concatenate RewriteRules (by default [AND] operator is used):

RewriteCond %{REMOTE_ADDR} !^11\.111\.111\.111 [OR]
RewriteCond %{REMOTE_ADDR} !^22\.222\.222\.222 [AND]
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteRule ^(.*)$ http://domain.com/maintenance.html [R=502,L]

PD: correct status code for maintenance mode is 502, not 307.

Source Link
cybmeta
  • 20.6k
  • 5
  • 47
  • 56

Set the rules above the WordPress default rules and use the [OR] operator to concatenate RewriteRules (by default [AND] operator is used):

RewriteCond %{REMOTE_ADDR} !^11\.111\.111\.111 [OR]
RewriteCond %{REMOTE_ADDR} !^22\.222\.222\.222 [AND]
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteRule ^(.*)$ http://domain.com/maintenance.html [R=502,L]

PD: correct status code for maintenance mode is 502, not 307.