Forum Moderators: phranque
Hope some gurus here can help.
Having problem with the following in my .htaccess file;
RewriteEngine On
RewriteCond %{REMOTE_ADDR} ^222.164. [OR]
RewriteCond %{REMOTE_ADDR} ^222.165.
RewriteCond %{REQUEST_URI}!^/fbn/
RewriteRule (.*) /fbn/ [R=301,L]
RewriteCond %{REMOTE_ADDR} ^201.11. [OR]
RewriteCond %{REMOTE_ADDR} ^202.16. [OR]
RewriteCond %{REMOTE_ADDR} ^215.24.44.
Redirect permanent ^(.*)$ http://www.example.com$1
Second portion of the RewriteCond runs even if it does not meet the conditions stated.
Any advice appreciated.
Thanks.
Jim
Thanks for your help. I tried the following but it is still redirecting the second portion even when the conditions are not met.
RewriteEngine On
RewriteCond %{REMOTE_ADDR} ^222.164. [OR]
RewriteCond %{REMOTE_ADDR} ^222.165.
RewriteCond %{REQUEST_URI}!^/fbn/
RewriteRule (.*) /fbn/ [R=301,L]
RewriteCond %{REMOTE_ADDR} ^201.11. [OR]
RewriteCond %{REMOTE_ADDR} ^202.16. [OR]
RewriteCond %{REMOTE_ADDR} ^215.24.44.
RewriteRule (.*) http://www.example.com$1
Any other error you're able to spot from the above?
Thanks.
RewriteEngine On
#
RewriteCond %{REMOTE_ADDR} ^222\.164\. [OR]
RewriteCond %{REMOTE_ADDR} ^222\.165\.
RewriteRule !^fbn/ http://{HTTP_HOST}/fbn/ [R=301,L]
#
RewriteCond %{REMOTE_ADDR} ^201\.11\. [OR]
RewriteCond %{REMOTE_ADDR} ^202\.16\. [OR]
RewriteCond %{REMOTE_ADDR} ^215\.24\.44\.
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
Otherwise, your browser may show you a page it has cached, and not send the request to the server. If this happens, then the access-control code on your server can have no effect.
It isn't clear exactly what your goal here is, but note that if this code is intended to deflect the blocked-IP's requests to two specific pages on your site, then there is no need to use external redirects -- internal rewrites will be faster, more effective, and will 'hide' the action that your mod_rewrite code is taking from visitors. They will see the original URL, but the 'Your Access Denied' content.
Jim