Question

I'm trying to redirect specific IPs to another page but with the code I have below it's redirecting every visitor. this is what I have:

<IfModule mod_rewrite.c>
 RewriteEngine On

 Rewrite Cond %{(}REMOTE_ADDR} ^103\.11\.52\.115 [OR]
 Rewrite Cond %{(}REMOTE_ADDR} ^103\.11\.52\.116 [OR]
 Rewrite Cond %{(}REMOTE_ADDR} ^103\.11\.52\.118 [OR]
 Rewrite Cond %{(}REMOTE_ADDR} ^176\.67\.84\.253 [OR]
 Rewrite Cond %{(}REMOTE_ADDR} ^176\.67\.81\.161
 RewriteRule ^(.*)$ http://www.anotherpageonsitehere.com/page/04/index.php [L]

</IfModule>

how do I only redirect the IPs I want?

Was it helpful?

Solution

Syntax error I'd say... Try this instead:

<IfModule mod_rewrite.c>
 RewriteEngine On

 RewriteCond %{REMOTE_ADDR} ^103\.11\.52\.115 [OR]
 RewriteCond %{REMOTE_ADDR} ^103\.11\.52\.116 [OR]
 RewriteCond %{REMOTE_ADDR} ^103\.11\.52\.118 [OR]
 RewriteCond %{REMOTE_ADDR} ^176\.67\.84\.253 [OR]
 RewriteCond %{REMOTE_ADDR} ^176\.67\.81\.161
 RewriteRule ^(.*)$ http://www.anotherpageonsitehere.com/page/04/index.php [L]

</IfModule>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top