getDeviceForHttpRequest($_SERVER); // Is this device a mobile device? $isMobileDevice = $device->getCapability('is_wireless_device'); // When WURFL identifies some desktop web browsers, an array for this capability. Choose the first value of such an array. if (is_array($isMobileDevice)) { $isMobileDevice = $isMobileDevice[0]; } // Implement the HTTP 302 redirect by adding a response header, routing to the mobile user experience for mobile devices. // Confusing comparison - $isMobileDevice is a string, not a boolean if ($isMobileDevice == "true") { header("Location: " . $mobileRedirect); } else { header("Location: " . $desktopRedirect); } exit; ?>