.htaccess file all others whoa re not some browser

蓝咒 提交于 2019-12-20 04:06:50

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!