nginx 的移动跳转代码怎么写呢?
阿帕奇的是这样的RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos|UCBrowser|QQBrowser|wap"我转换成nginx的去用,好像不行!还是我没用对呢
求助啊军哥! # nginx configuration
location / {
if ($http_user_agent ~* ""android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos|UCBrowser|QQBrowser|wap""){
rewrite ^/\/$ http://m.xxxx.com/$/?mobile=2 redirect;
}
if ($http_user_agent ~* ""android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos|UCBrowser|QQBrowser|wap""){
rewrite ^/news/(+) http://www.xxxx.com/portal.php?mod=view&aid=$1&mobile=2 redirect;
}
}
这样好像写法不对啊 if ($http_user_agent ~* "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos|UCBrowser|QQBrowser|wap"){
rewrite ^/(.*)$ https://lnmp.org/$1 permanent; #具体规则不清楚你自己改改就行了 permanent 是301,redirect 302#
}
回复 3# 的帖子
终于解决了,感谢军哥!
页:
[1]