Home › Forums › CSS › Redirect users if on desktop to new URL › Re: Redirect users if on desktop to new URL
April 18, 2013 at 7:19 am
#132292
Participant
Include the Class in your project. If on WordPress that would be in your functions.php file.
Then just:
$detect = new Mobile_Detect();
if ($detect->isMobile()) {
header(‘Location: http://mobile.site.com/’)
}
If you want the opposite just use the logical operator Not `!`.
if (!$detect->isMobile()) {
header(‘Location: http://desktop.site.com/’)
}