Hi guys. I have an issue with redirecting mobile users to mobile url.
Define('MOBILE_URL_RAW', 'm.mysite.tld');
in __construct() of core/MY_Controller.php i have this following code:
if($this->detect->isMobile()){
$url = parse_url($_SERVER['REQUEST_URI']);
if($url["host"] != MOBILE_URL_RAW){
redirect(str_replace(MOBILE_URL_RAW, $url["host"], $url));
}
}
i also tried:
if($this->detect->isMobile() && $_SERVER["HTTP_HOST"] != MOBILE_URL_RAW){
redirect(str_replace(MOBILE_URL_RAW.$_SERVER['REQUEST_URI']);
}
but it seems not to work because the requested page keeps refreshing till it says 'couldnt get page' .
How to make it work?
Be Simple