【发布时间】:2012-04-22 17:29:13
【问题描述】:
我已经为此工作了一个星期,并已使用我的 .htaccess 文件进行了尝试,但即使这在 Firefox 中也基本不起作用...
页面没有正确重定向 Firefox 检测到 服务器正在以某种方式重定向对该地址的请求 永远不会完成。 此问题有时可能是由禁用或拒绝接受 cookie 引起的。
在 chrome 中它的说法.....
这个网页有一个重定向循环网页在 https://www.website.com/row/index.php 导致太多 重定向。清除本网站的 cookie 或允许第三方 cookie 可以解决问题。如果不是,它可能是一个服务器 配置问题,而不是您的计算机的问题。
我从 Maxminds 网站的 GeoIP PHP API 上传 GeoIP.dat 和 geoip.inc 文件到我主机上的一个目录,然后我使用以下 php 代码块编辑了我的 index.php 文件....
<?php
require_once("geoIP/geoip.inc");
$gi = geoip_open('geoIP/GeoIP.dat', GEOIP_MEMORY_CACHE);
$country = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']);
// prints the country code your visitor is in
$my_countriesrow = array('AD','AE','AF','AG','AI'.....ect);
$my_countrieseuro = array('AN','AT','BA','BE','BG','BY','CH'.....ect);
/* $my_country = array('GB','UK'); */
if (!in_array(strtolower($country), $my_countriesrow)) {
header('Location: https://www.website.com/row/index.php');
exit();
}
else if(!in_array(strtolower($country), $my_countrieseuro)){
header('Location: https://www.website.com/euro/index.php');
exit();
}
else {
header('Location: https://www.website.com/index.php');
exit();
}
// the end
geoip_close($gi);
?>
我认为这可能与我的 .htaccess 文件有关,因为它包含了这个......
# Make all requests have www in them
RewriteEngine On
RewriteCond %{HTTP_HOST} ^website\.com
RewriteRule ^(.*)$ https://www.website.com$1 [R=permanent,L]
不知道还能做什么已经把我所有的头发都拔掉了!非常感谢你们!
问候 -菲利普
【问题讨论】:
-
这个重定向在哪个页面上?不在它重定向到的任何页面上?
-
它在Harry主网站的index.php上!