WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] 2 languages, 2 sites, how to GeoIP? (4 posts)

  1. jonathanmorgan
    Member
    Posted 2 years ago #

    Hi there,

    We have a website: http://jonathanandsofia.com that we use for updating family and friends about our work in South Africa. We have readers in Sweden, so using Multisite, I've created http://sv.jonathanandsofia.com for our Swedish language content.

    My question is: how can I direct visitors from a Swedish IP automatically to sv.jonathanandsofia.com?

    Many thanks,
    Jonathan

  2. It is possible to execute country-specific redirects. If you have GeoIP Apache API configured on your server, simply extrapolate the following:

    RewriteEngine on
    RewriteCond %{ENV:GEOIP_COUNTRY_CODE} SE [NC]
    RewriteRule ^$ http://sv.jonathanandsofia.com [L]

    This method employs country codes (Sweden -- http://ftp.ics.uci.edu/pub/websoft/wwwstat/country-codes.txt -- in the example).

    Of course, you could also redirect based on country-specific TLD or even IP addresses.

  3. jonathanmorgan
    Member
    Posted 2 years ago #

    Thanks for your response!
    I actually ended up doing it using the Maxmind Geoip database instead.

  4. BoBoswell
    Member
    Posted 2 years ago #

    jonathanmorgan,

    Could you give me a bit of info on how you ended up doing this with Maxmind? I'm trying to do this now and have hit a bit of a roadblock.

    Forgive my ignorance on this, but I have a redirect script that is actually working fine. I just need to know WHERE to put it so that visitors are redirected as soon as they hit my domain.

    Any info is appreciated.

Topic Closed

This topic has been closed to new replies.

About this Topic