jonathanmorgan
Member
Posted 6 months 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
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.
jonathanmorgan
Member
Posted 6 months ago #
Thanks for your response!
I actually ended up doing it using the Maxmind Geoip database instead.
BoBoswell
Member
Posted 1 month 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.