Home > Backend Development > PHP Tutorial > nginx determines whether it is a mobile terminal/determines the browser language

nginx determines whether it is a mobile terminal/determines the browser language

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-28 08:27:53
Original
2297 people have browsed it

<code><span>#判断移动端,跳转转到m.aaa.com</span><span>if</span> (<span>$http_user_agent</span><span>~* (mobile|nokia|iphone|ipad|android|samsung|htc|blackberry))</span> {
    <span>rewrite</span><span> ^/(.*)$</span><span>http://m.aaa.com</span><span>redirect</span>;<span>#这里随意使用,这一行代表域名栏会跳转到m.aaa.com</span><span>#proxy_pass http://101.200.141.xx:8909;#这一行代表域名不会改变,继续使用aaa.com,但是真正使用的是m.aaa.com</span>
}</code>
Copy after login

——————————Separating line————————————–

<code><span>#nginx判断客户端浏览器语言</span><span>#中文</span><span>if</span> (<span>$http_accept_language</span><span>~* ^zh)</span>{
    <span>rewrite</span><span> ^/$</span><span>http://zh.aa.com/index.html?la=zh</span><span>redirect</span>;
}

<span>#英文</span><span>if</span> (<span>$http_accept_language</span><span>~* ^en)</span>{
    <span>rewrite</span><span> ^/$</span><span>http://us.aa.com/index.html?la=us</span><span>redirect</span>;
}</code>
Copy after login
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces how nginx determines whether it is a mobile terminal/determines the browser language, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template