httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Pasher <>
Subject Re: [users@httpd] per-subdirectory 405 Method Not Allowed in .htaccess file for read-only WebDAV
Date Fri, 05 Sep 2008 22:55:19 GMT
Vasiliy Baranov wrote:
> Dear Experts,
> I have a directory named 'foo' in which I have a subdirectory named 
> 'bar' and an '.htaccess' file in which I need to specify that all 
> methods expect GET, HEAD, OPTIONS, and PROPFIND on all resources in 
> the 'bar' subdirectory should result in 405 Method Not Allowed 
> response. The directory layout is as follows:
>    foo
>        .htaccess
>        bar
>        ...
> I cannot have .htaccess in 'bar' and thus cannot specify <LimitExcept> 
> for the 'bar' directory, plus <Limit> and <LimitExcept> both result in 
> 403 Forbidden rather than 405 Method Not Allowed. Am I to use 
> mod_rewrite rewrites with the R=405 flag? If so, can I somehow add the 
> list of allowed methods to the Allow header in 405 Method Not Allowed 
> responses as required by RFC 2616 section 10.4.6?
> The ultimate goal here is to make the 'bar' subdirectory of the 
> WebDAV-enabled 'foo' directory read-only for everyone.

Without being able to either move/create an .htaccess file under bar or 
specify the settings in the global apache config, I don't think there is 
a way to make the <Limit> apply just to the bar directory. You would 
need to encompass it in a <Directory> or <Location> directive, but those 
directives are only allowed in the global and virtualhost config context.

Even with mod_rewrite, since you are actually tricking the server to 
report the 405 error code, I don't think you'll be able to report a 
proper list of commands in the "Allow" header without using <Limit>.

Justin Pasher

The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message