Created
May 21, 2012 14:47
-
-
Save dmolsen/2762726 to your computer and use it in GitHub Desktop.
Using ua-parser-php for a redirect script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // require the ua-parser-php library | |
| require_once("/path/to/UAParser.php"); | |
| // parse the requesting user agent | |
| $result = UA::parse(); | |
| // redirect phones, to redirect tablets use isMobileDevice | |
| if ($result->isMobile) { | |
| header("location:http://dmolsen.com"); | |
| } | |
| // run through the rest of your code for the page for desktop devices & spiders | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment