How can I convince mod_rewrite to stay away from my Subversion repositories?

I have a site [hosted on DreamHost], using WordPress for the main content, but Subversion repositories in http://mysite/svn .

My file layout is:

Read More
webroot/
  blog   # wordrpress files
  .htaccess

My SVN repositories lay outside the web root, but they are correctly mapped to /svn/repository URLs.

When I put the WordPress permalink rewrite rules in my .htaccess file, the blog pages and permalinks work great, but it breaks Subversion.

This is my .htaccess file with everything extraneous removed:

RewriteEngine On
RewriteBase /

# try 1                                                                                       
#RewriteCond %{REQUEST_URI} svn [NC]                                                          
#RewriteRule . - [PT,L]                                                                       

# try 2                                                                                       
#RewriteRule ^svn.*  -  [PT,L]                                                                

# try 3
#RewriteCond %{REQUEST_URI} !^svn 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . blog/index.php [L]

The very last line breaks Subversion. Clients errors are like this:

$ svn ls https://mysite/svn/myrepo/
svn: PROPFIND request failed on '/svn'
svn: PROPFIND of '/svn': 405 Method Not Allowed (https://mysite)

If I comment out that last line, RewriteRule . blog/index.php, Subversion works. But having WordPress handle the the nice permalink stuff doesn’t.

I tried the three “ignore any URL starting with ‘svn’” approaches I’ve commented out above, and none work– they seem to not do ANYTHING. With or without the PT pass-through flag.

I have googled quite a bit and it seems others have been stumped with mod_rewrite and WebDAV (which Subversion uses) stepping on each other. I found an extremely similar abandoned SO question here too, but no working solutions. Any clues?

Related posts

Leave a Reply

5 comments

  1. I think you should call Dreamhost’s support. I have some websites with them and always had good support.

    Anyways, what about this solution?

    SVN repository (SVNRepo)

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{THE_REQUEST} SVNRepo
    RewriteRule . - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress