1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to block china traffic using .htaccess?

Discussion in 'HTML & Website Design' started by warman2442, Dec 9, 2007.

  1. #1
    Hello

    I know how to block IP's threw .htaccess but how do i block a specific country?

    I really need to block china traffic , since they are always up to no good, and steal bandwidth etc!

    Thanks

    Tyler
     
    warman2442, Dec 9, 2007 IP
  2. falcondriver

    falcondriver Well-Known Member

    Messages:
    963
    Likes Received:
    47
    Best Answers:
    0
    Trophy Points:
    145
    #2
    you have to use php or some other languages. ther are some free scripts that return a country for each ip (more or less accurate).
    or search gogle for "ip to country", there are also some paid services.
     
    falcondriver, Dec 9, 2007 IP
  3. DonCash

    DonCash Peon

    Messages:
    51
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Try adding this to your .htaccess file:

    
    order deny,allow 
    deny from .ca 
    
    Code (markup):
    This is the easiest way to do it...
     
    DonCash, Dec 11, 2007 IP
  4. yangyang

    yangyang Banned

    Messages:
    757
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    0
    #4
    .ca is a canadian domain, to block china, you should use .cn
     
    yangyang, Dec 11, 2007 IP
  5. warman2442

    warman2442 Active Member

    Messages:
    1,779
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    98
    #5
    Yea i dont want to block my own country! lol

    Ok i will try the .cn, i dont see how that would block it.. Since they dont login threw my domains with .cn lol

    i think it will have to be with IP's

    Tyler
     
    warman2442, Dec 11, 2007 IP
  6. twistedspikes

    twistedspikes Notable Member

    Messages:
    5,694
    Likes Received:
    293
    Best Answers:
    0
    Trophy Points:
    280
    #6
    Blocking a country is often a bad idea. Your reasoning behind it here seems pretty dumb to me.
     
    twistedspikes, Dec 11, 2007 IP
  7. warman2442

    warman2442 Active Member

    Messages:
    1,779
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    98
    #7
    How is my reasoning behind it dumb, all ip's from china are stealing bandwidth like crazy, hotlinking etc. And spam using my proxies doing illegal stuff etc, seems actually smart to block them so i dont get in trouble for my servers being used in illegal activities...


    Tyler
     
    warman2442, Dec 11, 2007 IP
  8. twistedspikes

    twistedspikes Notable Member

    Messages:
    5,694
    Likes Received:
    293
    Best Answers:
    0
    Trophy Points:
    280
    #8
    Fair enough banning the IP's doing that, but banning a country because of some of it's members?
     
    twistedspikes, Dec 11, 2007 IP
  9. warman2442

    warman2442 Active Member

    Messages:
    1,779
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    98
    #9
    99% of China's ip address's are up to no good, and china traffic is useless in good pay per click etc, whats the positive? lol


    Tyler
     
    warman2442, Dec 11, 2007 IP
  10. gonka

    gonka Peon

    Messages:
    342
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #10
    You need GeoIP, google it
     
    gonka, Dec 11, 2007 IP
  11. falcondriver

    falcondriver Well-Known Member

    Messages:
    963
    Likes Received:
    47
    Best Answers:
    0
    Trophy Points:
    145
    #11
    yeah have the same experience with china traffic. so far i had 1 person from china who made a usefull comment, and about ~300 spam attemps from china or for some .cn domains (full of spam) until i blocked them.
     
    falcondriver, Dec 12, 2007 IP
  12. procrastinator

    procrastinator Peon

    Messages:
    1,718
    Likes Received:
    56
    Best Answers:
    0
    Trophy Points:
    0
    #12
    ive blocked china in my image host, it really took the host down before that.
     
    procrastinator, Dec 12, 2007 IP
  13. DonCash

    DonCash Peon

    Messages:
    51
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13

    Yeah sorry! .cn is china.
     
    DonCash, Dec 14, 2007 IP
  14. 87Lakers

    87Lakers Active Member

    Messages:
    162
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #14
    87Lakers, Oct 22, 2008 IP
  15. bhnetwork

    bhnetwork Member

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #15
    try this
    it 's really great tool

    http://www.maxmind.com/app/mod_geoip
     
    bhnetwork, Feb 20, 2009 IP
  16. giorgioarmani

    giorgioarmani Well-Known Member

    Messages:
    2,633
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    160
    #16
    giorgioarmani, Feb 20, 2009 IP
  17. billy_the_sound

    billy_the_sound Member

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #17
    thanks for the script.

    this site http://www.countryipblocks.net/ is really great, i tried it. It block many ip from china :cool:
     
    billy_the_sound, Feb 20, 2009 IP
  18. tech_manager

    tech_manager Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #18
    There are several options you have to block specific countries. At Country IP Blocks we currently offer seven different format options for country ip data, including .htaccess.

    Before you begin blocking countries at random I would suggest you develop a plan. Where do you want your traffic to come from? If you plan on denying a specific country or countries why do you want to do so? Log all your traffic and identify the problem areas.

    Denying a country using .htaccess with an extension like .cn is extremely ineffective as malicious traffic is often coming from IP ranges as opposed to top-level domains like .cn.

    As a side note, Country IP Blocks has a Top Ten List of Malicious traffic origins. The current breakdown is:

    1.) China
    2.) Brazil
    3.) Russia
    4.) India
    5.) Korea
    6.) Viet Nam
    7.) Ukraine
    8.) Turkey
    9.) Italy
    10.) Argentina

    This list updates every few weeks, but China has been at the top for months. Based on our latest data, these countries account for 78.7% of malicious traffic worldwide.
     
    tech_manager, May 16, 2009 IP
  19. Shirley1874

    Shirley1874 Peon

    Messages:
    558
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #19
    Though it is a fact, I have to say Chinese people are not that bad as you think. Most of them are kind hearted.
     
    Shirley1874, May 19, 2009 IP
  20. killjoy

    killjoy Well-Known Member

    Messages:
    201
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #20
    Yes, most are very kind.

    However if you do not sell to China, or other places, and they are far far away, then why not block the IP range?
    It cuts down risk of being attacked, and saves bandwidth and server load, making the internet faster in general :)

    Plus I am sure alot of companys may wish to aline with Government policy on certain countries and just dont want anything to do with them.

    We however use a blocklist tailered from previous attacks over the last 10years.

    Our list...

    China, Algeria, Argentina, Vietnam, Zambabwe, Uganda, Serbia, Palestinian Territories, Pakistan, Congo and CongoDr.
    Again we don't really just tar a country because of one person, but we asked ourselves the question, do we need those countrys to find us? and the answer was no.
     
    killjoy, May 19, 2009 IP