DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

William has posted 8 posts at DZone. View Full User Profile

How To Protect .svn

  • submit to reddit
        Having .svn on your live website is, I'm sure, a bad issue for security. But if you somehow have to live with it, here is a small snippet to deny .svn accessed from browser. Below is take from .htaccess for CakePHP webroot.

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
    RewriteRule .*\.svn/.* - [F]

<FilesMatch "\.svn/.*">
    Order allow,deny
    Deny from all