Post by dom44 » Sun Oct 02, 2011 9:34 am

Hi,

I'm am trying to block a group of IP addresses from my store and I have been searching the forum for some instructions on how to do this. I've come across the htaccess deny access method but I'm trying to modify this so visitors from that IP range do not get a "forbidden page" but rather are redirected to for example contactus.html .

Could anyone tell me how I could do this?

Thank you very much in advance.

New member

Posts

Joined
Thu Jul 16, 2009 6:54 am

Post by uksitebuilder » Mon Oct 03, 2011 3:44 am

In .htaccess

after RewriteBase / line

Code: Select all

RewriteCond %{REMOTE_HOST} 123\.456\.789\.123
RewriteCond %{REMOTE_HOST} 123\.456\.789\.123
RewriteCond %{REMOTE_HOST} 123\.456\.789\.123
RewriteRule .* /index.php?route=information/contact [R=301,L]
repeat the RewriteCond line for as many IP's you want to do this for

Note, you must escape the periods (dots) in the ip address with a backslash as per example above

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by dom44 » Tue Oct 04, 2011 5:54 am

Thanks Simon for helping me out.

I used the code you provided and now my .htaccess file looks like this:

Code: Select all

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} 123\.123\.123\.123
RewriteRule .* /ip.html [R=301,L]
I tested it out with my ip address but it doesn't seem to be working. Am I missing anything? Perhaps something before RewriteEngine On or after the code?

Thank you for your help.

New member

Posts

Joined
Thu Jul 16, 2009 6:54 am
Who is online

Users browsing this forum: No registered users and 245 guests