[Resolved] DirectoryMatch and Directory causes all 404s to become 403s

Discussion in 'Bug Reports' started by aww, May 10, 2010.

  1. aww

    aww New Member

    The use of DirectoryMatch or Directory, ie.

    Code:
    <DirectoryMatch "\.(svn|git)">
       Order allow,deny
       Deny from all
    </DirectoryMatch>
    
    or
    Code:
    <Directory ~ "\.(svn|git)">
       Order allow,deny
       Deny from all
    </Directory>
    
    Causes any 404 to instead become a 403

    ie. http://www.litespeedtech.com/ignore404fdgkdfgl1232365346.txt

    should properly produce a 404

    adding any directorymatch rule causes it to become 403, even if it's not affected by the rule
    Last edited by a moderator: May 12, 2010
  2. mistwang

    mistwang LiteSpeed Staff

    How was <Directory ...> directives are added?
    If you add those via Apache Style configuration in LSWS web console, it wont work properly, you should use LSWS native Context configuration instead.
  3. aww

    aww New Member

    added via .htaccess

    If litespeed doesn't support it, perhaps it could just ignore them so it doesn't break 404 errors.

    The rules need to be left there for apache backward compatibility.
  4. NiteWave

    NiteWave Administrator

    Hi,

    I did tests on Apache 2, if in .htaccess there is
    Code:
    <DirectoryMatch "\.(svn|git)">
       Order allow,deny
       Deny from all
    </DirectoryMatch>
    
    normal access to a file will return "500 Internal Server Error". without "<DirectoryMatch" directive, will be "200 OK".
    and there is an entry in error_log:
    Code:
    [Tue May 11 04:42:33 2010] [alert] [client x.x.x.x] /usr/local/apache/htdocs/.htaccess: <DirectoryMatch not allowed here
    
    in apache doc:
    http://httpd.apache.org/docs/2.0/mod/core.html#directory
    Code:
    <Directory> Directive
    Context:	server config, virtual host
    <DirectoryMatch> Directive
    Context:	server config, virtual host
    I was confused with it too. Thanks for raising the issue to get it clear.
    Last edited: May 11, 2010
  5. aww

    aww New Member

    Wow - that advice is given out all over the web and I guess everyone just repeats it without checking if it really can be used in .htaccess or not. Weird.

Share This Page