I am using the code below within my .htaccess file to place my site into maintenance. Essentially what it does is to redirect anyone who is NOT from a specific IP address to a .maintenance. subdomain where I have a maintenance page up (thus allowing me to perform testing on the real site). My question is, how would I add a second IP address to the line:
RewriteCond %{REMOTE_ADDR} !^23\.254\.12\.43
to allow 2 IP's to come through? Is it as simple as just putting a space and using the same format as the first one? (Sorry in advance if it really IS that simple, but I haven't tested it due to fear it may appear to be working but really not). Thanks!
###################################################################
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !^23\.254\.12\.43
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteRule ^(.*)$ http://maintenance.mysite.com [R=307,L]
####################################################################
Just adding another RewriteCond
to handle the second IP address should be fine, like so:
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !=23.254.12.43
RewriteCond %{REMOTE_ADDR} !=192.168.0.1
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteRule ^(.*)$ http://maintenance.mysite.com [R=307,L]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With