I need help with .htaccess (Filtering foreign countries)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • KMR Stitch
    I am cool
    • Jul 2003
    • 14494

    #1

    I need help with .htaccess (Filtering foreign countries)

    If someone can post a link on how to make an htacess file to redirect all foreign countries that would be great.

    or if someone can post their hta code here.


    Thanks!
  • darnoth
    Confirmed User
    • Jan 2005
    • 105

    #2
    You can't use an htaccess file to do that (unless you wrote a custom script and used external auth, but I think thats a bit beyond the scope of a forum post).

    Comment

    • KMR Stitch
      I am cool
      • Jul 2003
      • 14494

      #3
      nonsense.. I have seen it posted before and you list all the country extensions that you want to have the script redirect

      Comment

      • Steen2
        Confirmed User
        • Feb 2004
        • 7662

        #4
        If it's that easy - I would like to know too!
        ICQ: 2262.73945

        Comment

        • PolySix
          Registered User
          • Feb 2005
          • 19

          #5
          You can redirect by language easily enough.

          Check out http://www.htaccesstools.com/redirection-by-language/

          Comment

          • Lycanthrope
            Confirmed User
            • Jan 2004
            • 4517

            #6
            http://www.maxmind.com/app/geoip_country

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

            etc. and so forth
            Last edited by Lycanthrope; 03-29-2005, 02:18 AM.

            Comment

            • Lycanthrope
              Confirmed User
              • Jan 2004
              • 4517

              #7
              Or, if you just want to redirect all non us / ca traffic to one general place:

              RewriteEngine On
              RewriteCond %{ENV:GEOIP_COUNTRY_CODE} !^US$
              RewriteCond %{ENV:GEOIP_COUNTRY_CODE} !^CA$
              RewriteRule ^(.*)$ http://www.somethingthatmightconvert.com [R,L]

              Comment

              • Verotel
                Confirmed User
                • Oct 2002
                • 202

                #8
                Forgive me if this sounds stupid but wouldn't it be better to check the country/ip BEFORE the person joins to PREVENT them from joining?

                If you're talking .htaccess then doesn't that imply that it's a protected directory i.e., one in which you would have already had to pay for to gain access. Why would you want to redirect them at that point?

                I'm confused...
                Darryl McDade
                Merchant Relationship Executive
                Verotel Merchant Services BV

                Comment

                • Manowar
                  jellyfish  
                  • Dec 2003
                  • 71528

                  #9
                  http://www.businessvoyeur.com/2005-0...nking-in-depth

                  Thanks to fusion x

                  Comment

                  • iwantchixx
                    Too lazy to set a custom title
                    • Oct 2002
                    • 12860

                    #10
                    Originally posted by Verotel
                    Forgive me if this sounds stupid but wouldn't it be better to check the country/ip BEFORE the person joins to PREVENT them from joining?

                    If you're talking .htaccess then doesn't that imply that it's a protected directory i.e., one in which you would have already had to pay for to gain access. Why would you want to redirect them at that point?

                    I'm confused...
                    This is for filtering out unuseful traffic. He asked this for me. I don't get paid for it. So I might as well filter it out and send it elsewheres.

                    Comment

                    • iwantchixx
                      Too lazy to set a custom title
                      • Oct 2002
                      • 12860

                      #11
                      Originally posted by Lycanthrope
                      http://www.maxmind.com/app/geoip_country

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

                      etc. and so forth

                      hmm, thanks

                      Comment

                      Working...