PDA

View Full Version : Prevent any access to a directory with htaccess ?


Benj
05-14-2007, 07:32 PM
Hi,
I need to prevent access to some directories, but from the htaccess that is in /www.

So I need to put in the /www htaccess some directives so it will totally prevent access to /www/example directory.

For some reason, I cannot put an htaccess in /www/example, it needs to be done from the /www htaccess.

Is it possible ? if yes, how ?

Thanks,
Benj

hobbes
05-14-2007, 08:13 PM
The Directory* directives are server-wide and cannot be set via .htaccess; thus they are not an option if you can't create a .htaccess in www/example with "deny from all". You may however be able to redirect any requests to www/example/* elsewhere; a search of these forums for RewriteEngine should provide examples.

kitchin
05-14-2007, 08:42 PM
Maybe RedirectMatch (http://httpd.apache.org/docs/1.3/mod/mod_alias.html#redirectmatch) if you're going to do it that way.

RedirectMatch ^/example/ http://example.com/404.html

Not tested.