Forum Moderators: phranque

Message Too Old, No Replies

.htaccess to deny all but one user agent

         

mcrosoft

4:08 pm on Jul 8, 2005 (gmt 0)

10+ Year Member



hello people. this is my first post here.

thanks for providing this helpful infrastructure!

my question:

i want to protect a directory via .htaccess to allow only one specified user-agent.
all others should be denied.

could somebody please spend a little time helping me in this issue?

big thanks in advance.

jdMorgan

8:17 pm on Jul 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



mcrosoft,

Welcome to WebmasterWorld!

You can easily use either mod_access [httpd.apache.org] and mod_setenvif [httpd.apache.org], or mod_rewrite [httpd.apache.org] to accomplish this.

A couple of points to remember are that User-agents can easily be spoofed (or suppressed by firewalls and/or caching proxies), and that you may be blocking search engines from your site.

Jim

mcrosoft

1:46 am on Jul 9, 2005 (gmt 0)

10+ Year Member



thank you!

SetEnvIf User-Agent ^KnockKnock/2\.0 let_me_in
Order Deny,Allow
Deny from all
Allow from env=let_me_in

was exactly what i needed :)