Với sự phát triển chóng mặt của Smart Phone, tất nhiên là các website sẽ tập trung phát triển mảng dành cho di động và nó cũng nằm trong tiêu chuẩn đánh giá thứ hạng seo.
Thông thường developer sẽ phát triển website dành cho di động theo hai hướng: thiết kết responsive web hoặc xây dựng giao diện mới trên di động và chuyển hướng khi người dùng truy cập vào trang giao diện dành cho PC.
Vậy, làm sao biết người dùng sử dụng thiết bị Smart Phone mà chuyển hướng?
Việc chuyển hướng website này khá dễ thực hiện với một vài cách sau
1. Dùng .htaccess
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 | <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / # Check if this is the noredirect query string RewriteCond %{QUERY_STRING} (^|&)m=0(&|$) # Set a cookie, and skip the next rule RewriteRule ^ – [CO=mredir:0:www.tenmiencuaban.com] # Check if this looks like a mobile device # (You could add another [OR] to the second one and add in what you # had to check, but I believe most mobile devices should send at # least one of these headers) RewriteCond %{HTTP:x-wap-profile} !^$ [OR] RewriteCond %{HTTP:Profile} !^$ [OR] RewriteCond %{HTTP_USER_AGENT} “sony|symbian|nokia|samsung|mobile” [NC,OR] RewriteCond %{HTTP_USER_AGENT} “windows ce|epoc|opera|mini|nitro” [NC,OR] RewriteCond %{HTTP_USER_AGENT} “j2me|midp-|cldc-|netfront|mot” [NC,OR] RewriteCond %{HTTP_USER_AGENT} “up\.browser|up\.link|audiovox” [NC,OR] RewriteCond %{HTTP_USER_AGENT} “mini|nitro|j2me|midp-|cldc”[NC,OR] RewriteCond %{HTTP_USER_AGENT} “netfront|mot|up\.browser|up\.link”[NC,OR] RewriteCond %{HTTP_USER_AGENT} “audiovox|blackberry|ericsson,”[NC,OR] RewriteCond %{HTTP_USER_AGENT} “panasonic|philips|sanyo|sharp|sie-“[NC,OR] RewriteCond %{HTTP_USER_AGENT} “portalmmm|blazer|avantgo|dange”[NC,OR] RewriteCond %{HTTP_USER_AGENT} “palm|series60|palmsource|pocketpc”[NC,OR] RewriteCond %{HTTP_USER_AGENT} “smartphone|rover|ipaq|au-mic,”[NC,OR] RewriteCond %{HTTP_USER_AGENT} “alcatel|ericy|vodafone\/|wap1\.”[NC,OR] RewriteCond %{HTTP_USER_AGENT} “wap2\.|iPhone|android”[NC,OR] RewriteCond %{HTTP_USER_AGENT} “googlebot-mobile”[NC] RewriteCond %{HTTP_USER_AGENT} !macintosh [NC] # Check if we’re not already on the mobile site RewriteCond %{HTTP_HOST} !^m\. # Can not read and write cookie in same request, must duplicate condition RewriteCond %{QUERY_STRING} !(^|&)m=0(&|$) # Check to make sure we haven’t set the cookie before RewriteCond %{HTTP_COOKIE} !^.*mredir=0.*$ [NC] # Now redirect to the mobile site RewriteRule ^ http://m.tenmiencuaban.com [R,L] </ifModule> |
2. Dùng PHP
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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | $userBrowser = $_SERVER[‘HTTP_ACCEPT’]; if(stristr($userBrowser, ‘application/vnd.wap.xhtml+xml’)) { $_REQUEST[‘wap2’] = 1; } elseif(stripos($_SERVER[‘HTTP_USER_AGENT’],”iPod”)) { $_REQUEST[‘iphone’] = 1; } elseif(stripos($_SERVER[‘HTTP_USER_AGENT’],”iPhone”)) { $_REQUEST[‘iphone’] = 1; } elseif(stripos($_SERVER[‘HTTP_USER_AGENT’],”Android”)) { $_REQUEST[‘Android’] = 1; } elseif(stripos($_SERVER[‘HTTP_USER_AGENT’],”IEMobile”)) { $_REQUEST[‘IEMobile’] = 1; } elseif(stristr($userBrowser, ‘DoCoMo/’ || ‘portalmmm/’)) { $_REQUEST[‘imode’] = 1; } elseif(stristr($userBrowser, ‘text/vnd.wap.wml’)) { $_REQUEST[‘wap’] = 1; } elseif(stristr($userBrowser, ‘text/html’)) { $_REQUEST[‘html’] = 1; } if(!defined(‘WAP’)) define(‘WAP’, isset($_REQUEST[‘wap’]) || isset($_REQUEST[‘wap2’]) || isset($_REQUEST[‘imode’])|| isset($_REQUEST[‘html’])|| isset($_REQUEST[‘Android’])|| isset($_REQUEST[‘iphone’])|| isset($_REQUEST[‘IEMobile’])); if (WAP) { define(‘WIRELESS_PROTOCOL’, isset($_REQUEST[‘wap’]) ? ‘wap’ : (isset($_REQUEST[‘wap2’]) ? ‘wap2’ : (isset($_REQUEST[‘iphone’]) ? ‘iphone’ : (isset($_REQUEST[‘imode’]) ? ‘imode’ : (isset($_REQUEST[‘IEMobile’]) ? ‘IEMobile’ :(isset($_REQUEST[‘html’]) ? ‘html’ : (isset($_REQUEST[‘Android’]) ? ‘Android’ : ”))))))); if (WIRELESS_PROTOCOL == ‘wap’) { $browser_t = “mobile”; } elseif (WIRELESS_PROTOCOL == ‘wap2’) { $browser_t = “mobile”; } elseif (WIRELESS_PROTOCOL == ‘imode’) { $browser_t = “mobile”; } elseif (WIRELESS_PROTOCOL == ‘iphone’) { $browser_t = “smartphone”; } elseif (WIRELESS_PROTOCOL == ‘Android’) { $browser_t = “smartphone”; } elseif (WIRELESS_PROTOCOL == ‘IEMobile’) { $browser_t = “smartphone”; } elseif (WIRELESS_PROTOCOL == ‘html’) { $mobile_browser = ‘0’; if(preg_match(‘/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone)/i’, strtolower($_SERVER[‘HTTP_USER_AGENT’]))){ $mobile_browser++; } if((strpos(strtolower($_SERVER[‘HTTP_ACCEPT’]),’application/vnd.wap.xhtml+xml’)>0) or ((isset($_SERVER[‘HTTP_X_WAP_PROFILE’]) or isset($_SERVER[‘HTTP_PROFILE’])))){ $mobile_browser++; } $mobile_ua = strtolower(substr($_SERVER[‘HTTP_USER_AGENT’],0,4)); $mobile_agents = array( ‘w3c ‘,’acs-‘,’alav’,’alca’,’amoi’,’audi’,’avan’,’benq’,’bird’,’blac’, ‘blaz’,’brew’,’cell’,’cldc’,’cmd-‘,’dang’,’doco’,’eric’,’hipt’,’inno’, ‘ipaq’,’java’,’jigs’,’kddi’,’keji’,’leno’,’lg-c’,’lg-d’,’lg-g’,’lge-‘, ‘maui’,’maxo’,’midp’,’mits’,’mmef’,’mobi’,’mot-‘,’moto’,’mwbp’,’nec-‘, ‘newt’,’noki’,’oper’,’palm’,’pana’,’pant’,’phil’,’play’,’port’,’prox’, ‘qwap’,’sage’,’sams’,’sany’,’sch-‘,’sec-‘,’send’,’seri’,’sgh-‘,’shar’, ‘sie-‘,’siem’,’smal’,’smar’,’sony’,’sph-‘,’symb’,’t-mo’,’teli’,’tim-‘, ‘tosh’,’tsm-‘,’upg1′,’upsi’,’vk-v’,’voda’,’wap-‘,’wapa’,’wapi’,’wapp’, ‘wapr’,’webc’,’winw’,’winw’,’xda’,’xda-‘); if(in_array($mobile_ua,$mobile_agents)){ $mobile_browser++; } if (strpos(strtolower($_SERVER[‘ALL_HTTP’]),’OperaMini’)>0) { $mobile_browser++; } if (strpos(strtolower($_SERVER[‘HTTP_USER_AGENT’]),’iemobile’)>0) { $mobile_browser++; } if (strpos(strtolower($_SERVER[‘HTTP_USER_AGENT’]),’windows’)>0) { $mobile_browser=0; } if($mobile_browser>0){ // do something wap $browser_t = “mobile”; } // non-mobile else { $_SESSION[‘Browser_d’] = “web”; $browser_t = “web”; } } else { // do something else html $_SESSION[‘Browser_d’] = “web”; $browser_t = “web”; } } else { $mobile_browser = ‘0’; if(preg_match(‘/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone)/i’, strtolower($_SERVER[‘HTTP_USER_AGENT’]))){ $mobile_browser++; } if((strpos(strtolower($_SERVER[‘HTTP_ACCEPT’]),’application/vnd.wap.xhtml+xml’)>0) or ((isset($_SERVER[‘HTTP_X_WAP_PROFILE’]) or isset($_SERVER[‘HTTP_PROFILE’])))){ $mobile_browser++; } $mobile_ua = strtolower(substr($_SERVER[‘HTTP_USER_AGENT’],0,4)); $mobile_agents = array( ‘w3c ‘,’acs-‘,’alav’,’alca’,’amoi’,’audi’,’avan’,’benq’,’bird’,’blac’, ‘blaz’,’brew’,’cell’,’cldc’,’cmd-‘,’dang’,’doco’,’eric’,’hipt’,’inno’, ‘ipaq’,’java’,’jigs’,’kddi’,’keji’,’leno’,’lg-c’,’lg-d’,’lg-g’,’lge-‘, ‘maui’,’maxo’,’midp’,’mits’,’mmef’,’mobi’,’mot-‘,’moto’,’mwbp’,’nec-‘, ‘newt’,’noki’,’oper’,’palm’,’pana’,’pant’,’phil’,’play’,’port’,’prox’, ‘qwap’,’sage’,’sams’,’sany’,’sch-‘,’sec-‘,’send’,’seri’,’sgh-‘,’shar’, ‘sie-‘,’siem’,’smal’,’smar’,’sony’,’sph-‘,’symb’,’t-mo’,’teli’,’tim-‘, ‘tosh’,’tsm-‘,’upg1′,’upsi’,’vk-v’,’voda’,’wap-‘,’wapa’,’wapi’,’wapp’, ‘wapr’,’webc’,’winw’,’winw’,’xda’,’xda-‘); if(in_array($mobile_ua,$mobile_agents)){ $mobile_browser++; } if (strpos(strtolower($_SERVER[‘HTTP_USER_AGENT’]),’iemobile’)>0) { $mobile_browser++; } if (strpos(strtolower($_SERVER[‘ALL_HTTP’]),’OperaMini’)>0) { $mobile_browser++; } if (strpos(strtolower($_SERVER[‘HTTP_USER_AGENT’]),’windows’)>0) { $mobile_browser=0; } if($mobile_browser>0){ // do something wap $browser_t = “mobile”; } // non-mobile else { $_SESSION[‘Browser_d’] = “web”; $browser_t = “web”; } } |
Các bạn có thể tham khảo từ source code ví dụ sau: chuyển hướng website
Với sự phát triển chóng mặt của Smart Phone, tất nhiên là các website sẽ tập trung phát triển mảng dành cho di động và nó cũng nằm trong tiêu chuẩn đánh giá thứ hạng seo.
Thông thường developer sẽ phát triển website dành cho di động theo hai hướng: thiết kết responsive web hoặc xây dựng giao diện mới trên di động và chuyển hướng khi người dùng truy cập vào trang giao diện dành cho PC.
Vậy, làm sao biết người dùng sử dụng thiết bị Smart Phone mà chuyển hướng?
Việc chuyển hướng website này khá dễ thực hiện với một vài cách sau
1. Dùng .htaccess
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 | <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / # Check if this is the noredirect query string RewriteCond %{QUERY_STRING} (^|&)m=0(&|$) # Set a cookie, and skip the next rule RewriteRule ^ – [CO=mredir:0:www.tenmiencuaban.com] # Check if this looks like a mobile device # (You could add another [OR] to the second one and add in what you # had to check, but I believe most mobile devices should send at # least one of these headers) RewriteCond %{HTTP:x-wap-profile} !^$ [OR] RewriteCond %{HTTP:Profile} !^$ [OR] RewriteCond %{HTTP_USER_AGENT} “sony|symbian|nokia|samsung|mobile” [NC,OR] RewriteCond %{HTTP_USER_AGENT} “windows ce|epoc|opera|mini|nitro” [NC,OR] RewriteCond %{HTTP_USER_AGENT} “j2me|midp-|cldc-|netfront|mot” [NC,OR] RewriteCond %{HTTP_USER_AGENT} “up\.browser|up\.link|audiovox” [NC,OR] RewriteCond %{HTTP_USER_AGENT} “mini|nitro|j2me|midp-|cldc”[NC,OR] RewriteCond %{HTTP_USER_AGENT} “netfront|mot|up\.browser|up\.link”[NC,OR] RewriteCond %{HTTP_USER_AGENT} “audiovox|blackberry|ericsson,”[NC,OR] RewriteCond %{HTTP_USER_AGENT} “panasonic|philips|sanyo|sharp|sie-“[NC,OR] RewriteCond %{HTTP_USER_AGENT} “portalmmm|blazer|avantgo|dange”[NC,OR] RewriteCond %{HTTP_USER_AGENT} “palm|series60|palmsource|pocketpc”[NC,OR] RewriteCond %{HTTP_USER_AGENT} “smartphone|rover|ipaq|au-mic,”[NC,OR] RewriteCond %{HTTP_USER_AGENT} “alcatel|ericy|vodafone\/|wap1\.”[NC,OR] RewriteCond %{HTTP_USER_AGENT} “wap2\.|iPhone|android”[NC,OR] RewriteCond %{HTTP_USER_AGENT} “googlebot-mobile”[NC] RewriteCond %{HTTP_USER_AGENT} !macintosh [NC] # Check if we’re not already on the mobile site RewriteCond %{HTTP_HOST} !^m\. # Can not read and write cookie in same request, must duplicate condition RewriteCond %{QUERY_STRING} !(^|&)m=0(&|$) # Check to make sure we haven’t set the cookie before RewriteCond %{HTTP_COOKIE} !^.*mredir=0.*$ [NC] # Now redirect to the mobile site RewriteRule ^ http://m.tenmiencuaban.com [R,L] </ifModule> |
2. Dùng PHP
PHP
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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | $userBrowser = $_SERVER[‘HTTP_ACCEPT’]; if(stristr($userBrowser, ‘application/vnd.wap.xhtml+xml’)) { $_REQUEST[‘wap2’] = 1; } elseif(stripos($_SERVER[‘HTTP_USER_AGENT’],”iPod”)) { $_REQUEST[‘iphone’] = 1; } elseif(stripos($_SERVER[‘HTTP_USER_AGENT’],”iPhone”)) { $_REQUEST[‘iphone’] = 1; } elseif(stripos($_SERVER[‘HTTP_USER_AGENT’],”Android”)) { $_REQUEST[‘Android’] = 1; } elseif(stripos($_SERVER[‘HTTP_USER_AGENT’],”IEMobile”)) { $_REQUEST[‘IEMobile’] = 1; } elseif(stristr($userBrowser, ‘DoCoMo/’ || ‘portalmmm/’)) { $_REQUEST[‘imode’] = 1; } elseif(stristr($userBrowser, ‘text/vnd.wap.wml’)) { $_REQUEST[‘wap’] = 1; } elseif(stristr($userBrowser, ‘text/html’)) { $_REQUEST[‘html’] = 1; } if(!defined(‘WAP’)) define(‘WAP’, isset($_REQUEST[‘wap’]) || isset($_REQUEST[‘wap2’]) || isset($_REQUEST[‘imode’])|| isset($_REQUEST[‘html’])|| isset($_REQUEST[‘Android’])|| isset($_REQUEST[‘iphone’])|| isset($_REQUEST[‘IEMobile’])); if (WAP) { define(‘WIRELESS_PROTOCOL’, isset($_REQUEST[‘wap’]) ? ‘wap’ : (isset($_REQUEST[‘wap2’]) ? ‘wap2’ : (isset($_REQUEST[‘iphone’]) ? ‘iphone’ : (isset($_REQUEST[‘imode’]) ? ‘imode’ : (isset($_REQUEST[‘IEMobile’]) ? ‘IEMobile’ :(isset($_REQUEST[‘html’]) ? ‘html’ : (isset($_REQUEST[‘Android’]) ? ‘Android’ : ”))))))); if (WIRELESS_PROTOCOL == ‘wap’) { $browser_t = “mobile”; } elseif (WIRELESS_PROTOCOL == ‘wap2’) { $browser_t = “mobile”; } elseif (WIRELESS_PROTOCOL == ‘imode’) { $browser_t = “mobile”; } elseif (WIRELESS_PROTOCOL == ‘iphone’) { $browser_t = “smartphone”; } elseif (WIRELESS_PROTOCOL == ‘Android’) { $browser_t = “smartphone”; } elseif (WIRELESS_PROTOCOL == ‘IEMobile’) { $browser_t = “smartphone”; } elseif (WIRELESS_PROTOCOL == ‘html’) { $mobile_browser = ‘0’; if(preg_match(‘/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone)/i’, strtolower($_SERVER[‘HTTP_USER_AGENT’]))){ $mobile_browser++; } if((strpos(strtolower($_SERVER[‘HTTP_ACCEPT’]),’application/vnd.wap.xhtml+xml’)>0) or ((isset($_SERVER[‘HTTP_X_WAP_PROFILE’]) or isset($_SERVER[‘HTTP_PROFILE’])))){ $mobile_browser++; } $mobile_ua = strtolower(substr($_SERVER[‘HTTP_USER_AGENT’],0,4)); $mobile_agents = array( ‘w3c ‘,’acs-‘,’alav’,’alca’,’amoi’,’audi’,’avan’,’benq’,’bird’,’blac’, ‘blaz’,’brew’,’cell’,’cldc’,’cmd-‘,’dang’,’doco’,’eric’,’hipt’,’inno’, ‘ipaq’,’java’,’jigs’,’kddi’,’keji’,’leno’,’lg-c’,’lg-d’,’lg-g’,’lge-‘, ‘maui’,’maxo’,’midp’,’mits’,’mmef’,’mobi’,’mot-‘,’moto’,’mwbp’,’nec-‘, ‘newt’,’noki’,’oper’,’palm’,’pana’,’pant’,’phil’,’play’,’port’,’prox’, ‘qwap’,’sage’,’sams’,’sany’,’sch-‘,’sec-‘,’send’,’seri’,’sgh-‘,’shar’, ‘sie-‘,’siem’,’smal’,’smar’,’sony’,’sph-‘,’symb’,’t-mo’,’teli’,’tim-‘, ‘tosh’,’tsm-‘,’upg1′,’upsi’,’vk-v’,’voda’,’wap-‘,’wapa’,’wapi’,’wapp’, ‘wapr’,’webc’,’winw’,’winw’,’xda’,’xda-‘); if(in_array($mobile_ua,$mobile_agents)){ $mobile_browser++; } if (strpos(strtolower($_SERVER[‘ALL_HTTP’]),’OperaMini’)>0) { $mobile_browser++; } if (strpos(strtolower($_SERVER[‘HTTP_USER_AGENT’]),’iemobile’)>0) { $mobile_browser++; } if (strpos(strtolower($_SERVER[‘HTTP_USER_AGENT’]),’windows’)>0) { $mobile_browser=0; } if($mobile_browser>0){ // do something wap $browser_t = “mobile”; } // non-mobile else { $_SESSION[‘Browser_d’] = “web”; $browser_t = “web”; } } else { // do something else html $_SESSION[‘Browser_d’] = “web”; $browser_t = “web”; } } else { $mobile_browser = ‘0’; if(preg_match(‘/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone)/i’, strtolower($_SERVER[‘HTTP_USER_AGENT’]))){ $mobile_browser++; } if((strpos(strtolower($_SERVER[‘HTTP_ACCEPT’]),’application/vnd.wap.xhtml+xml’)>0) or ((isset($_SERVER[‘HTTP_X_WAP_PROFILE’]) or isset($_SERVER[‘HTTP_PROFILE’])))){ $mobile_browser++; } $mobile_ua = strtolower(substr($_SERVER[‘HTTP_USER_AGENT’],0,4)); $mobile_agents = array( ‘w3c ‘,’acs-‘,’alav’,’alca’,’amoi’,’audi’,’avan’,’benq’,’bird’,’blac’, ‘blaz’,’brew’,’cell’,’cldc’,’cmd-‘,’dang’,’doco’,’eric’,’hipt’,’inno’, ‘ipaq’,’java’,’jigs’,’kddi’,’keji’,’leno’,’lg-c’,’lg-d’,’lg-g’,’lge-‘, ‘maui’,’maxo’,’midp’,’mits’,’mmef’,’mobi’,’mot-‘,’moto’,’mwbp’,’nec-‘, ‘newt’,’noki’,’oper’,’palm’,’pana’,’pant’,’phil’,’play’,’port’,’prox’, ‘qwap’,’sage’,’sams’,’sany’,’sch-‘,’sec-‘,’send’,’seri’,’sgh-‘,’shar’, ‘sie-‘,’siem’,’smal’,’smar’,’sony’,’sph-‘,’symb’,’t-mo’,’teli’,’tim-‘, ‘tosh’,’tsm-‘,’upg1′,’upsi’,’vk-v’,’voda’,’wap-‘,’wapa’,’wapi’,’wapp’, ‘wapr’,’webc’,’winw’,’winw’,’xda’,’xda-‘); if(in_array($mobile_ua,$mobile_agents)){ $mobile_browser++; } if (strpos(strtolower($_SERVER[‘HTTP_USER_AGENT’]),’iemobile’)>0) { $mobile_browser++; } if (strpos(strtolower($_SERVER[‘ALL_HTTP’]),’OperaMini’)>0) { $mobile_browser++; } if (strpos(strtolower($_SERVER[‘HTTP_USER_AGENT’]),’windows’)>0) { $mobile_browser=0; } if($mobile_browser>0){ // do something wap $browser_t = “mobile”; } // non-mobile else { $_SESSION[‘Browser_d’] = “web”; $browser_t = “web”; } } |
Các bạn có thể tham khảo từ source code ví dụ sau: chuyển hướng website