【问题标题】:Always add parameter to url WordPress始终将参数添加到 url WordPress
【发布时间】:2015-02-11 04:32:19
【问题描述】:

我正在使用 WordPress 发布游戏和应用程序。现在我想检测国家以显示帖子。

有没有办法像这样在url中添加默认参数:

http://demo.com/?geo=VN

http://demo.com/?category/games/?geo=VN

【问题讨论】:

  • 是什么意思?请正确解释问题。
  • 当访问者访问我的网站时。我想通过将地理参数添加到当前网址来检测他们的国家/地区以加载应用程序和游戏。

标签: wordpress url redirect parameters


【解决方案1】:

您可以使用像geoplugin 这样的插件。

只需在索引中添加所需的代码即可。

它应该看起来像这样:

<?php
require_once('geoplugin.class.php');
$geoplugin = new geoPlugin();
$geoplugin->locate();
// create a variable for the country code
$var_country_code = $geoplugin->countryCode;
// redirect based on country code:
if ($var_country_code == "VN") {
header('Location: http://demo.com/?geo=VN');
}
else if ($var_country_code == "AU") {
header('Location: http://demo.com/?geo=AU');
}
else {
header('Location: http://demo.com/');
}
?>

【讨论】:

  • 感谢您的回复,我试试看。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-04-24
  • 2015-06-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-05-30
  • 1970-01-01
相关资源
最近更新 更多