Block access to .svn directories using htaccess

It is a good idea to block access to .svn directories if you are using Subversion. Otherwise, anyone can read the files. Add the following snippet to your .htaccess file (in root directory of the website).

  1. <IfModule mod_rewrite.c>
  2. # Block access to .svn files
  3. RewriteRule ^(.*/)?\.svn/ - [F,L]
  4. ErrorDocument 403 "Access Forbidden"
  5. </IfModule>

Add new comment