I have a site [hosted on DreamHost], using WordPress for the main content, but Subversion repositories in http://mysite/svn .
My file layout is:
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_FILE开发者_如何学JAVANAME} !-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?
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
How about
RewriteCond %{REQUEST_URI} !^/svn.*
?
Have you considered moving your Subversion repositories to a different subdomain? For example, http://svn.mysite.com/
This would be an easy way out.
I've spent many hours pulling my hair out over mod_rewrite...any time you can avoid that, it's a win.
Try #3 looks good, have you tried there:
RewriteCond %{REQUEST_URI} !^svn.*
Try
RewriteCond %{REQUEST_FILENAME} !(.*)svn(.*)
精彩评论