Redirect web site by browser IP

article #902, updated 3269 days ago

The following in an .htaccess file, will redirect all web-browser clients except the one using IP 111.111.111.111

<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{REMOTE_ADDR} !^111\.111\.111\.111
 RewriteCond %{REQUEST_URI} !/maint.html$ [NC]
 RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
 RewriteRule .* /maint.html [R=302,L]
</IfModule>

Categories: