.htaccess仅允许来自Chrome,Opera,Mozilla,Safari和其他用户的重定向 [英] .htaccess allow only from Chrome, Opera, Mozilla, Safari, redirect from others
本文介绍了.htaccess仅允许来自Chrome,Opera,Mozilla,Safari和其他用户的重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果用户不使用Chrome,Safari,Opera或Mozilla,我想配置重定向。
I want to configure redirect if the user doesn't use Chrome, Safari, Opera or Mozilla.
对于反问题(如果我不希望使用Chrome等) 。)有一个解决方案:
For inverse problem (if I don't want Chrome etc.) there is a solution:
RewriteCond %{HTTP_USER_AGENT} Chrome
RewriteRule ^abcd.html$ chrome.html [NC,L]
RewriteCond %{HTTP_USER_AGENT} Safari
RewriteRule ^abcd.html$ safari.html [NC,L]
在之前添加!
不起作用
推荐答案
否定是使用!
运算符完成的。使用 [NC]
标志还将丢弃诸如 chrome
, chRome $ c之类的字符串$ c>等:
Negation is done using the !
operator. Using the [NC]
flag will also discard strings like chrome
, chRome
etc:
RewriteCond %{HTTP_USER_AGENT} !Chrome [NC]
RewriteRule ^abcd.html$ chrome.html [NC,L]
这篇关于.htaccess仅允许来自Chrome,Opera,Mozilla,Safari和其他用户的重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文