Deny .svn Directory Access With .htaccess

The following little snippet in a .htaccess file in your web root will block access to .svn directories via http.

# Block access to .svn files
RewriteRule ^(.*/)?\.svn - [F,L]
ErrorDocument 403 "Access Forbidden"

I found this by googling but the original had a trailing / on the .svn in the RewriteRule.   I've removed this as with out it, it appears that /.svn/ would be blocked, but /.svn would still get through.

Friday 28 December 2012 at 8:56 pm | | Apache, Linux

No comments

(optional field)
(optional field)

Comment moderation is enabled on this site. This means that your comment will not be visible until it has been approved by an editor.

Remember personal info?
Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.