IP Geolocation Redirect


#1

Anyone knows any “free” GeoIP redirect via .htaccess file? For example if the user comes from China then the user gets redirected to Chinese Landing page and likewise for users from other countries


#2

You can do something like this. Do not forget to backup your .htaccess file before making changes.

GeoIPEnable On
GeoIPDBFile /path/to/GeoIP.dat

# Start Redirecting countries

# Canada
RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^CA$
RewriteRule ^(.*)$ http://ca.abcd.com$1 [L]

Inside RewriteRule you can define your custom URL.

Regards,
Ibad