Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Redirect users if on desktop to new URL Re: Redirect users if on desktop to new URL

#132292
Alen
Participant

http://mobiledetect.net/

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/’)
}