Yurt Dışından Gelenleri Farklı Bir Siteye Yönlendirmek mümkündür acaba?
naısl yapıcam yardımcı olabilecek varmı acaba?
apache+htaccess:
GEO IP modunun açık olup olmadığını sorun servis sağlayıcınıza. Edit: Gerçi siz de servis sağlayıcısıymışsınız:
https://dev.maxmind.com/geoip/legacy/mod_geoip2/
sonra htaccess inizde ulkeleri şu şekilde yonlendirin:
GeoIPEnable On
GeoIPDBFile /path/to/GeoIP.dat
RewriteEngine on
#Turkey
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^TR$
RewriteRule ^(.*)$ http://tr.domainadı.com$1 [L]
#uk
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^UK$
RewriteRule ^(.*)$ http://uk.domainadı.com$1 [L]Ayrıca, PHP için bu kodun çalıştığını söylenmiş, bir bakın istiyorsanız. Kaynak:
https://stackoverflow.com/questions/...once-using-php <?php
// Next two lines are for Beyond Hosting
// Don't forget to change your-domain
require_once '/home/your-domain/php/Net/GeoIP.php';
$geoip = Net_GeoIP::getInstance('/home/your-domain/php/Net/GeoIP.dat');
// Next two lines are for HostGator
require_once 'Net/GeoIP.php';
$geoip = Net_GeoIP::getInstance('GeoIP.dat');
try {
$country = $geoip->lookupCountryCode($_SERVER['REMOTE_ADDR']);
switch((string)$country) {
case 'AU':
$url = "http://www.site.au";
break;
case 'CA':
$url = "http://www.site.ca";
break;
default:
$url = "http://site.com";
}
if (strpos("http://$_SERVER[HTTP_HOST]", $url) === false)
{
header('Location: '.$url);
}
} catch (Exception $e) {
// Handle exception
}
?>