我现在的情况是这样的:
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]我想知道如何将此条件转换为上面的值之一的if not。
我想过这样的事情:
RewriteCond %{HTTP_USER_AGENT} !="android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]但是它不起作用。
发布于 2013-01-04 07:48:34
问题是在opera和mobile之间有一个空格,这会导致mod_rewrite将其解析为多个参数。尝试将括号而不是引号与!结合使用,并转义空格:
RewriteCond %{HTTP_USER_AGENT} !(android|blackberry|ipad|iphone|ipod|iemobile|opera\ mobile|palmos|webos|googlebot-mobile) [NC]发布于 2013-01-03 20:29:31
非常接近,您不需要在否定!之后添加=。
RewriteCond %{HTTP_USER_AGENT} !"android|blackberry|ipad|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]https://stackoverflow.com/questions/14138856
复制相似问题