How to ban some countries from our sites

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RayBonga
    too cool for highschool
    • Nov 2005
    • 12164

    #1

    How to ban some countries from our sites

    How do you redirect users from Nigeria, China, India, etc. to some alternative site/page?

    I'm gussing I should just create some htacecss file but not sure how to do it
  • tiger
    Confirmed User
    • Apr 2002
    • 6986

    #2
    Add Turkey to your list as well when you find out how.

    Comment

    • directfiesta
      Too lazy to set a custom title
      • Oct 2002
      • 30135

      #3
      Originally posted by tiger
      Add Turkey to your list as well when you find out how.
      agreed ...

      If you have a dedicated box, you can block whole countries thru the firewall ( not redirecting it to another page ).

      Otherwise. .htaccess with the whole range of IP would do it ( including redirecting ).

      IP of countries here
      I know that Asspimple is stoopid ... As he says, it is a FACT !

      But I can't figure out how he can breathe or type , at the same time ....

      Comment

      • ukxtra
        Confirmed User
        • Jan 2003
        • 844

        #4
        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} ^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]
        RewriteRule ^(.*)$ http://www.yoursite.com/whatever.html [R,L]

        or

        <SCRIPT language="JavaScript">
        ban = new Array('ad','ae','af','ag','ai','al','am','an','ao' ,'aq','ar','as','at','aw','ax','az','ba','bb','bd' ,'be','bf','bg','bh','bi','bj','bn','bo','br','bt' ,'bv','bw','by','bz','cc','cd','cf','cg','ch','ci' ,'ck','cl','cm','cn','co','cr','cs','cu','cv','cx' ,'cy','cz','dj','dm','do','dz','ec','ee','eg','eh' ,'er','es','et','fi','fj','fk','fm','fo','fr','fx' ,'ga','gd','ge','gf','gh','gl','gm','gn','gp','gq' ,'gr','gs','gt','gu','gw','gy','hk','hm','hn','hr' ,'ht','hu','id','il','in','io','iq','ir','is','it' ,'jm','jo','jp','ke','kg','kh','ki','km','kn','kp' ,'kr','kw','ky','kz','la','lb','lc','li','lk','lr' ,'ls','lt','lu','lv','ly','ma','mc','md','mg','mh' ,'mk','ml','mm','mn','mo','mp','mq','mr','ms','mt' ,'mu','mv','mw','mx','my','mz','na','nc','ne','nf' ,'ng','ni','nl','no','np','nr','nu','nz','om','pa' ,'pe','pf','pg','ph','pk','pl','pm','pn','pr','ps' ,'pt','pw','py','qa','re','ro','ru','rw','sa','sb' ,'sc','sd','se','sg','sh','si','sj','sk','sl','sm' ,'sn','so','sr','st','su','sv','sy','sz','tc','td' ,'tf','tg','th','tj','tk','tl','tm','tn','to','tp' ,'tr','tt','tv','tw','tz','ua','ug','uy','uz','va' ,'vc','ve','vg','vi','vn','vu','wf','ws','ye','yt' ,'yu','za','zm','zr','zw','edu','gov','mil','nato' );
        for(i in ban){
        if(navigator.userLanguage.indexOf(ban[i]) >=0){document.location.href="http://www.YOURSITE.com";}
        }
        </SCRIPT>

        Comment

        • Mr Pheer
          So Fucking Banned
          • Dec 2002
          • 22083

          #5
          Originally posted by ukxtra
          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} ^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]
          RewriteRule ^(.*)$ http://www.yoursite.com/whatever.html [R,L]
          is there another part to this? where does it get the geoip country code?

          Comment

          • ukxtra
            Confirmed User
            • Jan 2003
            • 844

            #6
            TBH not sure MrPheer, got it from here but not tried it. The JS one works fine though

            Originally posted by pocketkangaroo
            Always wondered what would happen if a bunch of big porn sites got together and did something like this for a couple days.

            PHP Code:
            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} ^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] 
            RewriteRule ^(.*)$ http://www.tubesite.com/longest-video-on-site.html [R,L] 
            

            Comment

            • Mr Pheer
              So Fucking Banned
              • Dec 2002
              • 22083

              #7
              ok.. thanks

              Comment

              Working...