Вопрос

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?

Это было полезно?

Решение

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>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top