Redirecting based on visitor domain

Discussion in 'Apache' started by adultuserbars, May 27, 2007.

  1. #1
    I don't know if my title describes exactly what I want to do.

    What I want to do is to redirect visitors from a particular country to a different website. I think I have heard something along the lines of an Apache mod that redirects according to IP address and where in the world that is, I want something like that, but I still would like access to my site.

    Say I want to redirect all visitors with .uk at the end of the hostname to a different site how would I go about doing that?
     
    adultuserbars, May 27, 2007 IP
  2. Bruzli

    Bruzli Peon

    Messages:
    17
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can use mod_geoip from MaxMind, it allows you to redirect from htaccess based on country:

    
    GeoIPEnable On
    GeoIPDBFile /path/to/GeoIP.dat
    
    RewriteEngine on
    RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^CA$
    RewriteRule ^(.*)$ http://www.canada.com$1 [L]
    
    Code (markup):
    More info here: MaxMInd GeoIP Apache API
     
    Bruzli, May 27, 2007 IP