WP-Mix

A fresh mix of code snippets and tutorials

Protect .svn files with .htaccess

For those using subversion, here is how to protect your svn files with .htaccess.

Working with subversion, it’s important to not store the .svn files on a public web server. Such files may contain passwords and other sensitive data. So to protect any svn files from prying eyes, add this snippet to the site’s root .htaccess file:

# protect svn files
RewriteEngine On
RewriteRule ^(.*/)?\.svn/? - [F,L]

Or, if you’d rather not invoke the majesty of mod_rewrite, roll one up with mod_alias:

# protect svn files
RedirectMatch 403 ^(.*/)?\.svn/?

Bada boom bada bing.

Learn more

.htaccess made easy