モバイル サイトからリダイレクトした後、メイン サイトを表示し続けることができません。
モバイル デバイスが検出されると、モバイル サイトにリダイレクトされます。モバイル サイトには「メイン サイト」リンクがあり、クリックするとメイン サイトに移動します。メイン サイトのホームページのリンクをクリックすると、何らかの理由でメイン サイトにとどまらず、モバイル サイトにリダイレクトされます。
Cookieが正しく保存されていないと思います。
<?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");
}
}
?>
それはおそらく単純なものですが、それを理解することはできません。
ありがとう!