This script is a easy way to redirect mobile devices to a mobile website.
At the bottom of the scripts are 2 locations you have to change to your own locations.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
<?php $text = $_SERVER['HTTP_USER_AGENT']; $agent[0] = 'Mozilla/4.'; $agent[1] = 'Mozilla/3.0'; $agent[2] = 'AvantGo'; $agent[3] = 'ProxiNet'; $agent[4] = 'Danger hiptop 1.0'; $agent[5] = 'DoCoMo/'; $agent[6] = 'Google CHTML Proxy/'; $agent[7] = 'UP.Browser/'; $agent[8] = 'SEMC-Browser/'; $agent[9] = 'J-PHONE/'; $agent[10] = 'PDXGW/'; $agent[11] = 'ASTEL/'; $agent[12] = 'Mozilla/1.22'; $agent[13] = 'Handspring'; $agent[14] = 'Windows CE'; $agent[15] = 'PPC'; $agent[16] = 'Mozilla/2.0'; $agent[17] = 'Blazer/'; $agent[18] = 'Palm'; $agent[19] = 'WebPro/'; $agent[20] = 'EPOC32-WTL/'; $agent[21] = 'Tungsten'; $agent[22] = 'Netfront/'; $agent[23] = 'Mobile Content Viewer/'; $agent[24] = 'PDA'; $agent[25] = 'MMP/2.0'; $agent[26] = 'Embedix/'; $agent[27] = 'Qtopia/'; $agent[28] = 'Xiino/'; $agent[29] = 'BlackBerry'; $agent[30] = 'Gecko/20031007'; $agent[31] = 'MOT-'; $agent[32] = 'UP.Link/'; $agent[33] = 'Smartphone'; $agent[34] = 'portalmmm/'; $agent[35] = 'Nokia'; $agent[36] = 'Symbian'; $agent[37] = 'AppleWebKit/413'; $agent[38] = 'UPG1 UP/'; $agent[39] = 'RegKing'; $agent[40] = 'STNC-WTL/'; $agent[41] = 'J2ME'; $agent[42] = 'Opera Mini/'; $agent[43] = 'SEC-'; $agent[44] = 'ReqwirelessWeb/'; $agent[45] = 'AU-MIC/'; $agent[46] = 'Sharp'; $agent[47] = 'SIE-'; $agent[48] = 'SonyEricsson'; $agent[49] = 'Elaine/'; $agent[50] = 'SAMSUNG-'; $agent[51] = 'Panasonic'; $agent[52] = 'Siemens'; $agent[53] = 'Sony'; $agent[54] = 'Verizon'; $agent[55] = 'Cingular'; $agent[56] = 'Sprint'; $agent[57] = 'AT&T;'; $agent[58] = 'Nextel'; $agent[59] = 'Pocket PC'; $agent[60] = 'T-Mobile'; $agent[61] = 'Orange'; $agent[62] = 'Casio'; $agent[63] = 'HTC'; $agent[64] = 'Motorola'; $agent[65] = 'Samsung'; $agent[66] = 'NEC'; $agent[67] = 'iPhone'; $agent[68] = 'Android'; $agent[69] = 'webOS'; $agent[70] = 'iPod'; $agent[71] = 'iPad'; $result = count($agent); for ($i=0;$i<$result;$i++) { if (strpos($text,$agent[$i]) == true) { header('Location: mobiel/'); //replace with your mobile location exit; } } header('Location: site/'); //replace with your desktop location ?> |
Leave a Reply