| Garry |
|
NetHosted Customer

Joined: 03 Oct 2005 Posts: 263 Location: Lincoln, UK
|
Posted: 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 |
|
| NetHosted - Andrew |
|
NetHosted Staff

Joined: 22 Mar 2004 Posts: 5684
|
Posted: 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 |
|
| Garry |
|
NetHosted Customer

Joined: 03 Oct 2005 Posts: 263 Location: Lincoln, UK
|
Posted: 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 |
|
| Garry |
|
NetHosted Customer

Joined: 03 Oct 2005 Posts: 263 Location: Lincoln, UK
|
Posted: 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 |
|
| NetHosted - Andrew |
|
NetHosted Staff

Joined: 22 Mar 2004 Posts: 5684
|
Posted: 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 |
|
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
|
| |