.htaccess question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • longdongsilver
    Confirmed User
    • Aug 2003
    • 378

    #1

    .htaccess question

    Does anyone have any code that i can add to the .htaccess file to redirect or block chinese surfers?

    getting a load of these guys eating up my bandwidth.

    thanks if anyone knows.
  • Theo
    HAL 9000
    • May 2001
    • 34515

    #2
    order allow,deny
    deny from IP
    deny from IP
    deny from IP
    deny from IP
    allow from all

    where IP should be in the form of XXX.XXX. (but you need the chinese ip ranges)

    Comment

    • XxXotic
      Confirmed User
      • Jun 2002
      • 8500

      #3
      http://www.htaccesstools.com/redirection_by_language/
      Oxeo - Serious Hosting For Serious Webmasters. iCQ:135.887013

      Comment

      • ltl
        Registered User
        • Jul 2003
        • 34

        #4
        If they are trying to brute force your server .htaccess won't save you any bandwidth (it still responds with Access Denied or sends a redirection header). Adding them to your firewall would work better as then you would loose all the outgoing bandwidth they are costing you and protect your server from the additional load though they'll still be on your servers connection and there's not much you can do about that though they should go away eventually if they are firewalled.

        I've found blocking these addresses with these masks has significantly cut down the nuisance factor from the Chinese for me... But there are other ISP's in China of course... it's just these are where a lot of the assholes were coming from...

        220.166.0.0/16
        220.167.0.0/17

        hope it helps.

        Comment

        • ltl
          Registered User
          • Jul 2003
          • 34

          #5
          Interesting tool but this redirects by the surfers browser language. If these guys are trying to brute force they won't be using a browser and so this will be totally useless as I see it...

          Comment

          • longdongsilver
            Confirmed User
            • Aug 2003
            • 378

            #6
            thanks guys


            if found this code but can't seem to get it to work ...(these are not the urls im using just that was the code when i found it)

            this just throws up a internal server error for anyone trying to visit

            RewriteEngine On
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?.*episodesusdbz/.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?advancedmoneyloans.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?affiliplanet.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?apart-?design.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?auktion.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?autogewinne24.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?autospiele24.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?babay.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?euromillionen.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?eurowins.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?gsm-support.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?qw8.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?geldspiele24.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?goovle.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?heil-fasten.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?immobiliengewinne24.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?incest-.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?keywordmaster.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?one2onemag.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?reisegewinne24.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?rootfood.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?shemale.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?single66.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?slamhost.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?spielepsychatrie.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?superface.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?topgewinn24.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?topspiele24.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?transexual.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?usa-wins.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?vendini.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?webmasterplan.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?wseeker.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?xmaster.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?referrer-script.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://www14\.blogspot.*$ [OR]
            RewriteCond %{HTTP_REFERER} ^http://(www\.)?yahh+oo.*$
            RewriteRule /* http://www.yoursite.com/restricted_url.html [R,L]

            Comment

            • longdongsilver
              Confirmed User
              • Aug 2003
              • 378

              #7
              I've managed to find the ip block tool in my control panel...however it won't let me add this

              220.166.0.0/16

              says invalid ip...so i just tried

              220.166.0.0.16

              and it says banned ip's 220.166.0.0

              there is no 16 on the end

              will it still work...and does anyone know how to find out the complete i.p range to ban everyone from china? or is there not a specific i.p range to do that?

              ok thanks

              Comment

              • GeXus
                Confirmed User
                • May 2003
                • 3320

                #8
                In your htaccess put

                DoNotAllow : Chinese;

                Comment

                • Lycanthrope
                  Confirmed User
                  • Jan 2004
                  • 4517

                  #9
                  Don't just block them, make some money off of them -

                  Have your host install Mod Geo IP if it isn't already and grab Max Mind's IP database, even their free one is decent: http://www.maxmind.com/app/mod_geoip (some hosts will already have a database installed)

                  Then, simply add this to your .htaccess file:

                  RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^CN$ [NC,OR]
                  RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^HK$ [NC,OR]
                  RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^MO$ [NC,OR]
                  RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^MY$ [NC,OR]
                  RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^SG$ [NC,OR]
                  RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^TW$ [NC]
                  RewriteRule ^(.*)$ http://www.chinese.url [R,L]

                  Signup for Jade Bucks and send them there (recommended), an aggressive dialer or even a toolbar sponsor that pays for shit installs like Loud Cash.

                  Comment

                  • macho
                    Confirmed User
                    • Nov 2001
                    • 2875

                    #10
                    Originally posted by Lycanthrope
                    Don't just block them, make some money off of them -

                    Have your host install Mod Geo IP if it isn't already and grab Max Mind's IP database, even their free one is decent: http://www.maxmind.com/app/mod_geoip (some hosts will already have a database installed)

                    Then, simply add this to your .htaccess file:

                    RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^CN$ [NC,OR]
                    RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^HK$ [NC,OR]
                    RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^MO$ [NC,OR]
                    RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^MY$ [NC,OR]
                    RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^SG$ [NC,OR]
                    RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^TW$ [NC]
                    RewriteRule ^(.*)$ http://www.chinese.url [R,L]

                    Signup for Jade Bucks and send them there (recommended), an aggressive dialer or even a toolbar sponsor that pays for shit installs like Loud Cash.
                    Thanks for that information!
                    GayPay X2 -- #1in the niche! $35 per sign! Up to 70% revenue share! http://www.gaypay.com

                    Comment

                    • longdongsilver
                      Confirmed User
                      • Aug 2003
                      • 378

                      #11
                      yeah thank's nice tip

                      would this stop them hot-linking directly to movies also? or just stop them really from surfing the site with the browser?

                      Comment

                      • Lycanthrope
                        Confirmed User
                        • Jan 2004
                        • 4517

                        #12
                        Originally posted by longdongsilver
                        yeah thank's nice tip

                        would this stop them hot-linking directly to movies also? or just stop them really from surfing the site with the browser?
                        This redirects any and all requests for any file

                        Comment

                        • longdongsilver
                          Confirmed User
                          • Aug 2003
                          • 378

                          #13
                          awesome ..thanks

                          Comment

                          Working...