问题
I want to configure redirect if the user doesn't use Chrome, Safari, Opera or Mozilla.
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]
Adding !
before doesn't work
回答1:
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]
来源:https://stackoverflow.com/questions/39924802/htaccess-allow-only-from-chrome-opera-mozilla-safari-redirect-from-others