mod_rewrite的%{HTTP_USER_AGENT}不等于+或条件(名单)不等于、条件、名单、mod_rewrite

2023-09-02 09:39:21 作者:市井炊烟

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

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]
 
精彩推荐