I am wondering if it possible to block traffic from certain countries in a PHP document. (Example: if I don't want users from Iran to be able to access my site, what would I need to do).
Thanks in advance
-Steve
Question: Block Traffic from certain countries
Started by skilletsteve, Mar 07 2007 03:40 PM
8 replies to this topic
#1
Posted 07 March 2007 - 03:40 PM
|
|
|
#2
Posted 07 March 2007 - 09:14 PM
This should get you started: http://forum.codecal...ighlight=target
#3
Guest_Jordan_*
Posted 08 March 2007 - 12:34 PM
Guest_Jordan_*
I'm curious to know why you want to block them. Are they causing problems?
#4
Posted 08 March 2007 - 01:41 PM
Jordan said:
I'm curious to know why you want to block them. Are they causing problems?
I am getting started hosting a lot of proxy sites, and running adsense on the homepages. Users from Iran tend to use a LOT of bandwidth, and their clicks aren't worth that much on adsense.
so not 'problems' but I feel I would do better if they could not use my sites.
#5
Posted 09 March 2007 - 08:49 PM
(sorry to double post)
If anybody is wondering, I was informed that you can block traffic from different regions using the .htaccess file on the server.
If anybody is wondering, I was informed that you can block traffic from different regions using the .htaccess file on the server.
#6
Guest_Jordan_*
Posted 11 March 2007 - 01:18 AM
Guest_Jordan_*
I've never heard of blocking using .htaccess but I do not see why it can not be done. Were you able to implement this?
#7
Posted 11 March 2007 - 10:01 AM
yes I was, quite easily actually. I just used the following code
and for all the denies I simply went to this page IP address range lookup
and selected Iran.
Quote
order allow,deny
allow from all
deny from 62.60.128.0/17
deny from 62.193.0.0/19
Etc...
allow from all
deny from 62.60.128.0/17
deny from 62.193.0.0/19
Etc...
and for all the denies I simply went to this page IP address range lookup
and selected Iran.
#8
Posted 11 March 2007 - 10:09 AM
Wouldn't you need to do an .htaccess for every directory though?
#9
Posted 11 March 2007 - 10:12 AM
Chan said:
Wouldn't you need to do an .htaccess for every directory though?
Yes, but I simply just downloaded the .htacess and them uploaded it into every directory. (And since what I run is proxy sites there were not that many directories. I am sure for other sites that are more content heavy this method may not have been the best choice.)


Sign In
Create Account


Back to top









