问题
I have this code:
RewriteCond %{HTTP_USER_AGENT} (navigator) [NC]
RewriteRule ^newfolder/(.*)$ /index.html [L,NC]
I em intresting in first line - How to put ALL OTHERS BROWSERS WHO ARE NOT NAVIGATOR? Somethung like:
RewriteCond %{HTTP_USER_AGENT} (navigator) [NC] ALL OTHERS WHO ARE NOT NAVIGATOR!
回答1:
You can use negation in RewriteCond
:
RewriteCond %{HTTP_USER_AGENT} !(opera|navigator|safari)
RewriteRule ^newfolder/(.*)$ /index.html [L,NC]
PS; Take note of RewriteCond %{HTTP_USER_AGENT} !navigator
which means all user agents except navigator
.
来源:https://stackoverflow.com/questions/21704271/htaccess-file-all-others-whoa-re-not-some-browser