Preventing access to .svn folders in Apache

This is straight from the mailing list with grateful thanks to Ryan Schmidt.

Sometimes I can be a bit slow so I hadn't even considered blocking access to the .svn folders on this and other sites I maintain. I have now! There are two solutions:

<Files ".svn">
    Order allow,deny
    Deny from all
</Files>
<DirectoryMatch "/\.svn/">
    Order allow,deny
    Deny from all
</DirectoryMatch>

and:

RedirectMatch 404 /\.svn(/|$)

I went for the latter which has the advantage of making it look like there are no .svn folders and it doesn't log any errors.

Thu, 2006-02-02 10:51
( categories: )