nginx 經過user-agent判斷是手機的瀏覽器

user-agent 收集:css

http://www.developershome.com/wap/detection/detection.asp?page=userAgentHeader

http://search.cpan.org/~cmanley/Mobile-UserAgent-1.05/lib/Mobile/UserAgent.pm

http://www.zytrax.com/tech/web/mobile_ids.html

http://en.wikipedia.org/wiki/List_of_user_agents_for_mobile_phones
html

nginxjava

location = / {nginx

root /var/www/path;
if ($http_user_agent ~* "Nokia") { rewrite . /index.html break; }web

if ($http_user_agent ~* "Mobile") { rewrite . /index.html break; }

if ($http_user_agent ~* "SAMSUNG") { rewrite . /index.html break; } }瀏覽器

if ($http_user_agent ~* "SonyEricsson") { rewrite . /index.html break; }
if ($http_user_agent ~* "MOT") { rewrite . /index.html break; } }
if ($http_user_agent ~* "BlackBerry") { rewrite . /index.html break; }
if ($http_user_agent ~* "LG") { rewrite . /index.html break; } }
if ($http_user_agent ~* "HTC") { rewrite . /index.html break; }ide

if ($http_user_agent ~* "J2ME") { rewrite . /index.html break; }
if ($http_user_agent ~* "Opera Mini") { rewrite . /index.html break; } }
index index.html;
}post

相關文章
相關標籤/搜索