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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.