htaccess redirect rule help needed.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sponsorpimp
    Confirmed User
    • Apr 2008
    • 1567

    #1

    htaccess redirect rule help needed.

    I want to redirect GB visitors to a diffrent URL by using htaccess I have tried the code below with no luck at all can anyone help!

    RewriteEngine On
    RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^GB$
    RewriteRule ^(.*)$ http://gb.example.com$1 [L]



    Thanks
  • darksoul
    Confirmed User
    • Apr 2002
    • 4997

    #2
    the code should do just make sure you have mod_geoip installed
    1337 5y54|)m1n: 157717888
    BM-2cUBw4B2fgiYAfjkE7JvWaJMiUXD96n9tN
    Cambooth

    Comment

    • sponsorpimp
      Confirmed User
      • Apr 2008
      • 1567

      #3
      Is there a simple way of doing this for affiliates? like some simple code they can put on the home page to redirect traffic from the UK to another site?

      I need it as simple as possible for affiliates to get around without having to install anything on the server.

      Comment

      • klinton
        So Fucking Banned
        • Apr 2003
        • 8766

        #4
        you can also redirect by browser language... it's not 100 % accurate however...

        google how to do it ;-)

        oh wait, i have one url for you ;]
        http://www.htaccesstools.com/redirection-by-language/

        Comment

        • sponsorpimp
          Confirmed User
          • Apr 2008
          • 1567

          #5
          Originally posted by klinton
          you can also redirect by browser language... it's not 100 % accurate however...

          google how to do it ;-)

          oh wait, i have one url for you ;]
          http://www.htaccesstools.com/redirection-by-language/
          Thanks for the info but not quite what I am looking for as it must redirect only UK visitors which is English so it would redirect all English counties and not just the UK (GB)

          Like the site though...

          Comment

          • raymor
            Confirmed User
            • Oct 2002
            • 3745

            #6
            Originally posted by sponsorpimp
            Is there a simple way of doing this for affiliates? like some simple code they can put on the home page to redirect traffic from the UK to another site?

            I need it as simple as possible for affiliates to get around without having to install anything on the server.
            No. They could redirect based on remote_host if their server has reverse resolution on, but it shouldn't be on. It's very resource intensive.
            For historical display only. This information is not current:
            support@bettercgi.com ICQ 7208627
            Strongbox - The next generation in site security
            Throttlebox - The next generation in bandwidth control
            Clonebox - Backup and disaster recovery on steroids

            Comment

            • klinton
              So Fucking Banned
              • Apr 2003
              • 8766

              #7
              Originally posted by sponsorpimp
              Thanks for the info but not quite what I am looking for as it must redirect only UK visitors which is English so it would redirect all English counties and not just the UK (GB)

              Like the site though...
              for uk english it should be: en-gb code....
              for australia it is: en-au, for usa it is en-us..... and so on....
              however, like I told, it's not 100 % accurate, so I think your only other way is only by using geo IP redirect...

              Comment

              • Nasty
                Confirmed User
                • Aug 2002
                • 1575

                #8
                Originally posted by sponsorpimp
                I want to redirect GB visitors to a diffrent URL by using htaccess I have tried the code below with no luck at all can anyone help!

                RewriteEngine On
                RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^GB$
                RewriteRule ^(.*)$ http://gb.example.com$1 [L]

                Thanks
                heres mine

                Code:
                RewriteEngine on
                RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(CN|HK|TW)$
                RewriteRule ^(.*)$ http://someothersite.com/$1 [L]

                “Ours is a world of nuclear giants and ethical infants. We know more about war than we know about peace, more about killing than we know about living. If we continue to develop our technology without wisdom or prudence, our servant may prove to be our executioner.” ― Omar Bradley (1948)

                Comment

                • sponsorpimp
                  Confirmed User
                  • Apr 2008
                  • 1567

                  #9
                  Thanks for the answers, anyone else?

                  Comment

                  • fris
                    Too lazy to set a custom title
                    • Aug 2002
                    • 55693

                    #10
                    you want what nasty has, unless you want to do it via php code
                    Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

                    Comment

                    • raymor
                      Confirmed User
                      • Oct 2002
                      • 3745

                      #11
                      Originally posted by klinton
                      for uk english it should be: en-gb code....
                      for australia it is: en-au, for usa it is en-us..... and so on....
                      however, like I told, it's not 100 % accurate, so I think your only other way is only by using geo IP redirect...
                      Also geo isn't anything like 100% accurate, as the main geo ip company, Maxmind, clearly states.
                      For historical display only. This information is not current:
                      support@bettercgi.com ICQ 7208627
                      Strongbox - The next generation in site security
                      Throttlebox - The next generation in bandwidth control
                      Clonebox - Backup and disaster recovery on steroids

                      Comment

                      Working...