I made a site it with some subdomains; according to the country's IP address the user is supposed to be automatically redirected to corresponding subdomain.
Example :
Main site is abcd.com
- Suppose some one from India typed this url abcd.com,
- then the page redirects to
ind.abcd.com
You could do this without
require_once('geoplugin.class.php');
like so:Check that you have the mod_geoip module (GeoIP Extension) installed on your server.
Then, tweak your
.htaccess
file accordingly :And here's the official documentation.
Download the geoPlugin class from:
http://www.geoplugin.com/_media/webservices/geoplugin.class.phps
Put a index.php file in your root folder:
Here is a list of country codes:
http://www.geoplugin.com/iso3166
If you are using a WordPress website, so its easy to use - (Geo Redirect plugin). It's working like charm. Easy to use, easy to implement.