Welcome Guest, Not a member yet? Register   Sign In
Redirecting to mobile url issue
#1

(This post was last modified: 03-31-2016, 03:07 PM by waptik.)

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 Angel
Reply


Messages In This Thread
Redirecting to mobile url issue - by waptik - 03-31-2016, 03:04 PM
RE: Redirecting to mobile url issue - by waptik - 04-01-2016, 02:16 PM
RE: Redirecting to mobile url issue - by PaulD - 04-01-2016, 04:28 PM



Theme © iAndrew 2016 - Forum software by © MyBB