2012-04-10 4 views
0
지금 일주일 동안이 작업을 한 내 htaccess로 파일과 그것을 시도했지만조차 그 말을 파이어 폭스에서 기본적으로 작동하지 않았다

에 따라 리디렉션 PHPMaxminds GeoIP가 ... 국가 코드

페이지가 올바르게 리디렉션되지 않음 Firefox가 서버가 이 완료되지 않는 방식으로이 주소에 대한 요청을 리디렉션 중임을 감지했습니다. 이 문제는 accecp 쿠키를 사용하지 않거나 거부함으로써 발생할 수 있습니다.

과 말 크롬의에서

.....

이 웹 페이지는 https://www.website.com/row/index.php에서 웹 페이지가 너무 많은 리디렉션 가져왔다에 리디렉션 순환 오류가 있습니다. 이 사이트의 쿠키를 지우거나 타사 쿠키를 허용하면 문제가 해결 될 수 있습니다. 그렇지 않은 경우 서버 구성 문제 일 수 있으며 컴퓨터에는 문제가 없습니다.

나는 ....

내 난 다음 PHP 코드 블록 내 index.php 파일을 편집 한 후 호스팅의 디렉토리로 GeoIP.dat 및 Maxminds 웹 사이트에서 GeoIP가 PHP API의 geoip.inc 파일을 업로드
<?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); 
?> 

나는

# Make all requests have www in them 
RewriteEngine On 
RewriteCond %{HTTP_HOST} ^website\.com 
RewriteRule ^(.*)$ https://www.website.com$1 [R=permanent,L] 

은 이미 내 머리를 당긴 할 그 밖의 무엇을 잘 모릅니다 .... 그것이 그것에서이 포함되어 나의 htaccess로 파일과 함께 할 수있는 뭔가가 있다고 생각 이! 많은 advace들 덕분에! 나는이 방문하고있어 경우이 코드를 가정

는 감사 -Phillip

+0

페이지이에 리디렉션되는이 같은

뭔가 루프를 방지 할 수 있는가? 리디렉션되는 페이지가 있습니까? – HarryBeasant

+0

메인 웹 사이트의 index.php에 해리! –

답변

0

업데이트]

"https://www.website.com/row/index.php"

에 포함되어 있습니다 BE의 페이지에서 첫 번째 if 문이 트리거되고 계속해서이 동일한 페이지로 이동합니다.

갱신 :

require_once("geoIP/geoip.inc"); 
$gi = geoip_open('geoIP/GeoIP.dat', GEOIP_MEMORY_CACHE); 
$country = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']); 
$my_countriesrow = array('AD','AE','AF','AG','AI'); 
$my_countrieseuro = array('AN','AT','BA','BE','BG','BY','CH'); 

/* if you got redirected, do not redirect again */ 
if (!isset($_GET['redirected'])) { 
    if (!in_array(strtolower($country), $my_countriesrow)) header('Location: https://www.website.com/row/index.php?redirected'); 
    else if(!in_array(strtolower($country), $my_countrieseuro)) header('Location: https://www.website.com/euro/index.php?redirected'); 
    else header('Location: https://www.website.com/index.php?redirected'); 
} 

geoip_close($gi); 
+0

그래, 내가 무슨 생각을하고 있었는지 롤, 따라서 내가 무슨 페이지에 있었는지 묻고 있었다 - 루키 실수입니다! – HarryBeasant

+0

옙 동일한 코드 블록이 모든 사이트의 모든 index.php 페이지에 있지만 여전히 리디렉션되지 않음 –

+0

Phillip, 내 대답을 다시 읽었습니다. 설명 : 모든 index.php 페이지에있는 경우 작동하지 않습니다. –

관련 문제