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.
If a different person on the Internet with the same configuration accesses your website, then their user agent will be the same.
The User-Agent (UA) string is contained in the HTTP headers and is intended to identify devices requesting online content. The User-Agent tells the server what the visiting device is (among many other things) and this information can be used to determine what content to return.
A browser's User-Agent string (UA) helps identify which browser is being used, what version, and on which operating system. When feature detection APIs are not available, use the UA to customize behavior or content to specific browser versions.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With