【发布时间】:2011-09-03 11:30:40
【问题描述】:
我有一个网站 www.xyz.com,其中包含特定国家 X 的内容。此外,我在同一域的子域(如 subdomain.xyz.com)上还有另一个指向不同国家 Y 的站点
我可以使用任何免费的地理 ip 数据库和一些 php 脚本来实现重定向,我成功地做到了,但现在问题是
来自 Y 国的人访问网站 www.xyz.com 被重定向到 subdomain.xyz.com,但假设他想检查 www.xyz.com 它再次将他们重定向到 subdoamin.xyz.com。
我希望这是 google 的方式,因此如果假设从阿联酋访问 google.com 的人被重定向到 google.ae,但如果他们点击转到 Go to Google.com,他们会毫无问题地被重定向到 google.com .
我需要为我的网站实现这个..
该网站在 wordpress 中。请建议我最好的解决方案。
好的,这是我用过的代码..
/**
* Example 6
*
* This is what google probably do with users around the world
*
* Multiple declatations
*/
// Start by including CountryDetector class
include("./src/CountryDetector.class.php");
// You dont need to create instance of this class you can access only on static context
// Google.co.uk
CountryDetector::redirect("AE", "http://uae.jobscow.com");
// Google Germania
CountryDetector::redirect(array("DE", "AT"), "http://google.de"); // Ausrian and German users
// Google China
CountryDetector::redirect("CN", "http://google.cn");
// Google sweden
CountryDetector::redirect("SE", "http://google.se");
// Google norwegia
CountryDetector::redirect("NO", "http://google.se");
// Google serbia
CountryDetector::redirect("RS", "http://google.rs");
// AND SO ON...
// Finally: Google.com - international
CountryDetector::redirect("international", "http://google.com");
?>
你会建议我对此做出哪些改变
【问题讨论】: