모바일 사이트에서 리디렉션 한 후 메인 사이트를 계속 표시하는 데 문제가 있습니다.모바일 사이트 만 메인 사이트 홈 페이지로 리디렉션됩니다.
모바일 장치가 감지되면 모바일 사이트로 리디렉션됩니다. 클릭하면 모바일 사이트에 "메인 사이트"링크가있어서 메인 사이트로 연결됩니다. 메인 사이트 홈 페이지의 링크를 클릭 할 때 어떤 이유로 메인 사이트에 머 무르지 않고 다시 모바일 사이트로 리디렉션됩니다.
쿠키가 올바르게 저장되지 않았다고 가정합니다.
<?php
@include("Mobile_Detect.php");
$detect = new Mobile_Detect();
$allow_mobile = isset($_COOKIE['mobile'])? true:false;
if (isset($_GET['mobile'])) {
if ($_GET['mobile']=='false'){
setcookie("mobile", "");
$allow_mobile = false;
} else {
setcookie("mobile", true, time() + 31536000, "/");
$allow_mobile = true;
}
}
if ($allow_mobile && $detect->isMobile()){
if (!$detect->isTablet()) {
header("Location:http://mobilesite.mobi");
}
}
$not_mobile_cookie = isset($_COOKIE['notmobile'])? true:false;
if (isset($_GET['mobile'])) $not_mobile_cookie = $_GET['mobile'];
if ($not_mobile_cookie==false && $detect->isMobile()){
if (!$detect->isTablet()) {
header("Location:http://mobile.mobi");
}
}
?>
아마도 간단 할 수도 있지만 알아낼 수는 없습니다.
감사합니다.
기본 사이트 링크에 어떤 변수를 추가하고 있습니까? – MrCode
변수는 /? mobile = false – Craig