-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample.php
More file actions
19 lines (18 loc) · 778 Bytes
/
sample.php
File metadata and controls
19 lines (18 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php
$userAgent = $_SERVER['HTTP_USER_AGENT'];
// Check if the user is on an iOS device
if (strpos($userAgent, 'iPhone') !== false || strpos($userAgent, 'iPad') !== false) {
// Redirect iOS users to a URL intended to be opened in Safari
$urlForSafari = 'https://www.apple.com';
header('Location: ' . $urlForSafari);
} elseif (strpos($userAgent, 'Android') !== false) {
// Redirect Android users to a URL formatted to open in Chrome
$urlForChrome = 'intent://www.android.com#Intent;package=com.android.chrome;S.browser_fallback_url=https://www.android.com;end';
header('Location: ' . $urlForChrome);
} else {
// Redirect all other users to a general URL
$generalUrl = 'https://www.huawei.com';
header('Location: ' . $generalUrl);
}
exit;
?>