Posted on Jun 11, 2009

Updating WordPress via SVN when the repository URL changes

WordPress has a great and constantly up-to-date wiki for administrators to manage WordPress installations via SVN. Every time a release is made, I just search google for “wordpress svn sw” and copy the svn sw link over to my terminal.

But recently they changed the repository URL — which means anyone using the old URL will get the following error when they try to update (assuming they are using the svn sw command):

svn: 'http://core.svn.wordpress.org/tags/2.8'
is not the same repository as
'http://svn.automattic.com/wordpress'

The fix for today’s (2.8) release is easy (replace 2.7.1 with whatever you were previously using):

svn switch --relocate http://svn.automattic.com/wordpress/tags/2.7.1 http://core.svn.wordpress.org/tags/2.7.1/ .

Then just do your normal:

svn sw http://core.svn.wordpress.org/tags/2.8/ .

It’s not hard to fix, but I’m not an avid user of SVN. So every time I do an update (assuming the repo URL has changed), I have to look at svn help and remember the syntax for changing repositories. Now, since I wrote this, I won’t need to. Perhaps this helped you too!

Posted on Jul 18, 2008

mod_rewrite RewriteRule flag ordering and WordPress

I spent about an hour yesterday looking up URL’s on my site that have been archived or moved over the years and redirecting them via .htaccess to the appropriate sections. The problem was, I could only get proxy rules to work within WordPress.

I kept trying the following, which I assumed would work after reading the apache mod_rewrite documentation:

RewriteRule ^gallery/$ /photos/ [R=301,L]

I finally gave up and went with a proxy rule that worked fine, but wasn’t exactly what I wanted (because the url didn’t get changed — ie, proxy).

RewriteRule ^gallery/$ /photos/ [P]

Just a second ago though, I thought to myself, “I wonder if the order of the flags plays a role.” And of course, it does… though I can’t find any documentation to support this.

So if you’re driven nuts trying to create a custom rewrite rule which won’t work for you, remember that order matters. Give the rule the last flag first, then the redirect flag.

RewriteRule ^gallery/$ /photos/ [L,R=301]

I suppose that might make a lot of sense to mod_rewrite veterans but not for me. I’m very glad I figured this out and hope this post can help someone (or me again) in the future.