Jump to content

deny IP Range with .htaccess and redirecting


natasha_thomas

Recommended Posts

Folkks,

 

I want to redirect to all the visitors form a particular IP range to another URL.

 

I am not able to integrate the redirect code into my existing .htaccess.

 

My Current .htaccess is:

Options -Indexes

ErrorDocument 404 /

ErrorDocument 403 /

ErrorDocument 500 /

 

 

RewriteEngine On

RewriteRule ^.*/.*\.htm$ 404.php [L]

 

 

RewriteRule ^([^\.]*)?\.htm$ index.php?name=$1 [NC,L]

 

RewriteRule .* - [E=HTTP_IF_MODIFIED_SINCE:%{HTTP:If-Modified-Since}]

RewriteRule .* - [E=HTTP_IF_NONE_MATCH:%{HTTP:If-None-Match}]

 

RewriteRule ^images/e/(.*)$ http://thumbs.ebaystatic.com/pict/$1 [R,L]

RewriteRule ^item-(.*)_(.*)_(.*)_(.*).html$ auction.php?title=$1&item=$2&country=$3&ccid=$4

RewriteRule ^item-(.*)_(.*)_(.*).html$ auction.php?title=$1&item=$2&country=$3

RewriteRule ^item-(.*)_(.*).html$ auction.php?title=$1&item=$2

 

 

 

The IP range to be banned is:

 

<Limit GET HEAD POST>

order allow,deny

# Country: JAPAN

# ISO Code: JP

# Total Networks: 2,428

# Total Subnets:  187,283,712

deny from 1.21.0.0/16

deny from 1.33.0.0/16

deny from 1.66.0.0/15

deny from 1.72.0.0/13

deny from 1.112.0.0/14

#

allow from all

</Limit>

 

How to integrate this IP range code in existing Htaccess then redirect the visitor form this IP range, ensuring there is no conflict with exiting .htaccess?

 

Cheers

Natasha T

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.