问题
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