Unable to commit to a subversion repository in a subdirectory shared by wordpress

wordpress

#1

Hi folks,

The title is slightly misleading, but here’s the situation.

I have installed wordpress in a folder named /blog/ off my website’s root folder, and followed the instructions[1] to configure it so that my website is served when a user visits my website root (i.e. if they visit example.org/ they get to my wordpress site). This involved putting an .htaccess file in the root folder, as well as an index.php file that loads wordpress from the /blog/ directory.

That works beautifully.

I also created a subversion repository which is accessible via http://example.org/svn. I can check out files from this repo, but I can’t commit.

When I try, I get the error:

~/project$ svn commit -m "initial import" svn: Commit failed (details follow): svn: 'http:/example.org/svn' path not found

I’m pretty sure this has something to do with the .htaccess file that wordpress had me create in the root folder. If i remove it, I can commit to the repo just fine (but then, of course, wordpress doesn’t work properly). Here’s what the .htaccess file looks like:

[code]

BEGIN WordPress

RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /blog/index.php [L] # END WordPress [/code]

As I understand it, it’s saying if any request comes in that isn’t for an existing file (!-f) or directory (!-d) send things on to /blog/index.php.

So, I tried adding a RewriteCond[2] to ignore any request that comes in for /svn. I haven’t had any luck getting this to work. I tried:

RewriteCond %(REQUEST_FILENAME} !/svn.*
RewriteCond %{REQUEST_URI} !/svn.*

and several variations of the CondPattern (e.g. !^/svn.*$, and so on), but nothing seems to work, so maybe I’m going about this the wrong way?

Any suggestions?

I also can’t seem to turn on logging (via RewriteLogLevel) so it’s really hard to know what’s going on behind the scenes. Any help with this would be awesome.

[1] http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory
[2] http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewritecond


#2

I normally set up my Subversion repository using Dreamhost’s Goodies option and an address like http://svn.example.com. That keeps the repository completely away from the WordPress install

Would that work?


#3

This link may be of use:
http://noahliebman.com/2008/03/a-subversion-gripe-htaccess-mod_rewrite-issue/

It’s also of someone having the exact same problem as you. Personally, I’d like to know why your negative rule doesn’t work (I’m not a mod_rewrite expert by any means).


#4

Thanks for your pointers guys.

I cracked it with some help from the Dreamhost support.

This is the rule I added before the Wordpress rewrite rules:

RewriteBase /
RewriteCond %{REQUEST_URI} ^/svn.*$ [NC]
RewriteRule . - [L]

There appears to be a bit of voodoo going on here, but essentially here’s how I understand it. RewriteCond matches any URI that starts with /svn. The [NC] means the match is case insenstive.

The RewriteRule simply says that no rewriting should be done, and the [L] makes sure no further rewrite processing is done.

Why this guy’s solution doesn’t work I have no idea. As I say, voodoo.

So there you have it.

Oh, and if you want to stop multiple URLs from being snatched up by wordpress, change the RewriteCond like so:

RewriteCond %{REQUEST_URI} ^/(svn|other_url|page.html|etc|and-so-on).*$ [NC]