Created
September 26, 2020 05:01
-
-
Save wpjess/47a3dcd62ee41c0f62c618d3992945d9 to your computer and use it in GitHub Desktop.
Redirect page based on device type
This file contains 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 | |
$iPod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod"); | |
$iPhone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone"); | |
$iPad = stripos($_SERVER['HTTP_USER_AGENT'],"iPad"); | |
$Android = stripos($_SERVER['HTTP_USER_AGENT'],"Android"); | |
$webOS = stripos($_SERVER['HTTP_USER_AGENT'],"webOS"); | |
if( $iPod || $iPhone || $iPad){ | |
header( 'Location: https://facebook.com' ); | |
die(); | |
} | |
else if($Android){ | |
header( 'Location: https://google.com' ); | |
die(); | |
} | |
else | |
{ | |
die(); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment