Client Support Community Server Status Contact Us Client Login
Email Hosting Website Hosting Reseller Hosting VPS Hosting Dedicated Servers

    Join our Community      Check your private messages       Profile       Search       FAQ       Memberlist       Log in


Blocking IPs

 
Post new topic   Reply to topic    NetHosted Community Index -> Web Design
Garry Reply with quote
 NetHosted Customer

 

 Joined: 03 Oct 2005
 Posts: 263
 Location: Lincoln, UK

PostPosted: Mon Aug 27, 2007 8:22 pm    Post subject: Blocking IPs
 
Hi,

How would I go about blocking a whole country from accessing my site ?
Like for example how would I block xxx.xxx.xxx.0/19

Would it also be possible to re-direct them to a special page

I have found this code

RewriteEngine on
RewriteCond %{REMOTE_ADDR} ^xxx.xxx.xxx.xxx$
RewriteRule ^(.*)$ http://www.yahoo.com  [L]

How would I get it to block xxx.xxx.xxx.0/19

_________________
Regards,
Garry
Happy NetHosted Customer
Back to top
View user's profile Send private message
NetHosted - Andrew Reply with quote
 NetHosted Staff

 

 Joined: 22 Mar 2004
 Posts: 5684
 

PostPosted: Mon Aug 27, 2007 9:26 pm    Post subject:
 
Garry,

Something like this would probably work for simply blocking them:

Order allow,deny
Allow from all
Deny from xx.0.0.0/19

Andrew

_________________
| Andrew Bassett
| Managing Director, NetHosted Ltd.
| Resellers, take a look at overselling !
| Members, tell us what you think  of NetHosted!
Back to top
View user's profile Send private message
Garry Reply with quote
 NetHosted Customer

 

 Joined: 03 Oct 2005
 Posts: 263
 Location: Lincoln, UK

PostPosted: Tue Aug 28, 2007 9:00 am    Post subject:
 
Hi,

While I was searching I can accross a website that tells you what to put in a .htaccess file to block a country: http://www.blockacountry.com/ 

This will return a 403 error

_________________
Regards,
Garry
Happy NetHosted Customer
Back to top
View user's profile Send private message
Garry Reply with quote
 NetHosted Customer

 

 Joined: 03 Oct 2005
 Posts: 263
 Location: Lincoln, UK

PostPosted: Thu Aug 30, 2007 9:04 am    Post subject:
 
Hi,

I do have one more question, can I put the block code anywhere in the .htaccess file ?

_________________
Regards,
Garry
Happy NetHosted Customer
Back to top
View user's profile Send private message
NetHosted - Andrew Reply with quote
 NetHosted Staff

 

 Joined: 22 Mar 2004
 Posts: 5684
 

PostPosted: Thu Aug 30, 2007 9:15 am    Post subject:
 
Yes, I see no reason why not!

Andrew

_________________
| Andrew Bassett
| Managing Director, NetHosted Ltd.
| Resellers, take a look at overselling !
| Members, tell us what you think  of NetHosted!
Back to top
View user's profile Send private message
Post new topic   Reply to topic    NetHosted Community Index -> Web Design
Page 1 of 1

User Permissions
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum

 
Jump to: