mod_rewrite的%{HTTP_USER_AGENT}不等于+或条件(名单) [英] mod_rewrite %{HTTP_USER_AGENT} not equal + or condition (list)

查看:285
本文介绍了mod_rewrite的%{HTTP_USER_AGENT}不等于+或条件(名单)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前的状况布莱恩这样的:

My current condition goin like that:

RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]

我不知道我怎么可以换这种情况为如果不是上面的值之一。

I wonder how can i swap this condition into "if not" one of the values above.

我因子评分类似的东西:

I tought about something like that:

RewriteCond %{HTTP_USER_AGENT} !="android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]

但它不工作。

but its doesnt work.

推荐答案

现在的问题是你有歌剧移动之间有一个空格,这将导致mod_rewrite的分析它的多个参数。尝试使用结合引号括号,而不是用 和逃避的空间!

The problem is you've got a space between opera and mobile, which causes mod_rewrite to parse it as multiple parameters. Try using parentheses instead of quotes in conjunction with ! and escape the space:

RewriteCond %{HTTP_USER_AGENT} !(android|blackberry|ipad|iphone|ipod|iemobile|opera\ mobile|palmos|webos|googlebot-mobile) [NC]

这篇关于mod_rewrite的%{HTTP_USER_AGENT}不等于+或条件(名单)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆