开发者

.htaccess Maintenance Multiple IP's

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 a开发者_StackOverflowdvance 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]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜