How to only allow one user agent on .htaccess?

青春壹個敷衍的年華 提交于 2019-12-04 22:11:09

问题


I have been searching all over google and I really need to know how to only allow one user agent on .htaccess?

All I found is how to do it on a Dedicated or private server.


回答1:


If the user-agent that you want to allow is: Lynx/2.8.8dev.12

Then you want these rules in the htaccess of the directory you want to restrict:

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} !Lynx/2\.8\.8dev\.12 [NC]
RewriteRule ^ - [F,L]

Every other user agent is forbidden with a 403.



来源:https://stackoverflow.com/questions/12142792/how-to-only-allow-one-user-agent-on-htaccess

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