Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

Block User Agent From Root and Sub-directories

8:19 pm on Feb 9, 2010 (gmt 0)

Preferred Member

10+ Year Member

joined:Jan 19, 2004
posts: 562
votes: 0

RewriteEngine on
RewriteCond %{HTTP_user_agent} libwww-perl [NC]
RewriteRule ^ - [F]

I am trying to use this from an old post by jdMorgan [webmasterworld.com...]

The result on my site is that it blocks access only to files in my root directory /public_html. Sub-directories are unaffected.

I have changed the user agent on my site to WebDataCentre and am testing with FireFox and the User Agent Switcher.

I am wondering if the problem lies in the way Apache is configured in my setup.
11:44 pm on Feb 9, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
votes: 0

Try adding "RewriteOptions inherit" to any subdirectories which have their own .htaccess files.

If that's not applicable or doesn't help, then disable MultiViews and, on APache 2.0 or higher, disable AcceptPathInfo if you don't use these features.

1:23 am on Feb 10, 2010 (gmt 0)

Preferred Member

10+ Year Member

joined:Jan 19, 2004
votes: 0

RewriteOptions inherit
This seems to be the ticket. Thanks so much.