Announcement

Collapse
No announcement yet.

.htaccess deny access- how do I set this up to ban entire countries?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • .htaccess deny access- how do I set this up to ban entire countries?

    I need to ban a select few countries from my website/message board that bring me 100 spammers a day and never a member in the many years of my site being open.

    From what I've read up, I need to set this up in my .htaccess file.

    My .htaccess file currently resides in my root directory.

    Where do I place the IP info in my .htaccess file? Just at the very bottom?

    How do I word it exactly, and I need to do this for multiple countries....

    Let's say I just wanted to do the two countries below....would I just copy and paste this information into the bottom of the .htaccess file?


    # <Limit GET HEAD POST>
    order allow,deny
    # Country: BURKINA FASO
    # ISO Code: BF
    # Total Networks: 10
    # Total Subnets: 31,488
    deny from 41.78.48.0/22
    deny from 41.138.96.0/19
    deny from 41.203.224.0/20
    deny from 41.216.144.0/20
    deny from 41.223.232.0/22
    deny from 192.136.55.0/24
    deny from 192.136.56.0/24
    deny from 192.136.57.0/24
    deny from 196.28.240.0/20
    deny from 212.52.128.0/19
    ## Country: BURUNDI
    # ISO Code: BI
    # Total Networks: 2
    # Total Subnets: 2,304
    deny from 196.2.8.0/21
    deny from 196.223.3.0/24
    #
    allow from all
    </Limit>
    Last edited by verbs; Sat 22nd Jan '11, 12:47pm.

  • #2
    Anyone????

    Comment


    • #4
      Is the format I used above the correct way to add to the file?

      How do I word it exactly, and I need to do this for multiple countries....

      Let's say I just wanted to do the two countries below....would I just copy and paste this information into the bottom of the .htaccess folder?


      # <Limit GET HEAD POST>
      order allow,deny
      # Country: BURKINA FASO
      # ISO Code: BF
      # Total Networks: 10
      # Total Subnets: 31,488
      deny from 41.78.48.0/22
      deny from 41.138.96.0/19
      deny from 41.203.224.0/20
      deny from 41.216.144.0/20
      deny from 41.223.232.0/22
      deny from 192.136.55.0/24
      deny from 192.136.56.0/24
      deny from 192.136.57.0/24
      deny from 196.28.240.0/20
      deny from 212.52.128.0/19
      ## Country: BURUNDI
      # ISO Code: BI
      # Total Networks: 2
      # Total Subnets: 2,304
      deny from 196.2.8.0/21
      deny from 196.223.3.0/24
      #
      allow from all
      </Limit>

      Comment


      • #5
        user banning options prevents users from registering or viewing the forum - no need to use .htaccess unless you want to block all web pages

        Comment


        • #6
          not from my understanding it doesn't. I use that to ban the spammers one by one as I come across their registrations, but I want to ban entire countries. Do you have any idea how long it would take me to add all those IP addresses of China, India, etc to the user banning section in the required format? My understanding is that the above format "212.52.128.0/19" is not accepted in that section, and it would take forever to re-write it to the proper format. Am I incorrect in my assumption?

          Comment


          • #7
            Originally posted by verbs View Post
            not from my understanding it doesn't. I use that to ban the spammers one by one as I come across their registrations, but I want to ban entire countries. Do you have any idea how long it would take me to add all those IP addresses of China, India, etc to the user banning section in the required format? My understanding is that the above format "212.52.128.0/19" is not accepted in that section, and it would take forever to re-write it to the proper format. Am I incorrect in my assumption?
            http://www.countryipblocks.net/

            that will hook you up
            Digital-Forums: www.digital-forums.com | CK3 Games: www.ck3.co.uk

            Comment


            • #8
              Originally posted by Raptor View Post
              http://www.countryipblocks.net/

              that will hook you up
              Thanks, that's where I got the information I posted above to block each country by IP address, I'm just trying to make sure I'm inputting it correctly into the .htaccess file.

              I just want SOMEONE here to verify I'm going about it the right way.

              Comment


              • #9
                I would love to do the same thing, ban countries from registering in the first place so I don't have to delete tons of spammers. It's too bad that a feature like this isn't built into the registration options in the first place.
                www.clubhonda.com

                Comment


                • #10
                  Well, I can verify that countryipblocks works! I went from about 50 visitors per day from India per google analytics down to zero! The pro is I don't have to deal with the spammers from india anymore, however it's a direct blow to my traffic which does play a factor in things like site valuations and advertising. I could easily lose 20%-30% of my traffic by banning all the spammer countries.

                  Comment

                  widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                  Working...
                  X