A Finland Swede in Bavaria

Friday, 9 January 2009

How to rename WordPress MU blog URLs (blogs.arno.fi/old to blogs.arno.fi/new)

I'm frustrated at spending lots of time on something which should be easy: To rename the URL of a WordPress blog from blogs.yoursite.com/oldname to blogs.yoursite.com/newname. However, I solved it, and this is how I did it. (I'll need to save this, or I will have forgotten it by the time I'll need it again).



It's supposed to be easy. This is what I think should suffice:

  1. Go to wp-admin on the uppermost level of WordPress MU. Pick "Site Admin" in the upper right corner.

  2. Click "Search Blogs" and pick "Edit" of the desired blog, such as "/oldname/"

  3. Change the field "Path" (from "/oldname/" to "/newname/") and press "Update Options"


Glitch 1 (minor): "Fileupload Url" isn't changed

  1. Remedy: Change "/oldname/" to "/newname/" in the "Fileupload Url" field on the same page and press "Update Options" again


Test: The site works. Blogs have moved from from blogs.yoursite.com/oldname to blogs.yoursite.com/newname. Hooray ... not yet.

Glitch 2 (major): Clicking on headers of individual posts leads to empty posts, although the text is there on the top level. (Doing the same with pages works.)

Remedy: Two steps, and I haven't tested doing only one of them.

Step 1: Manually change the guid field

  • Log into MySQL.

  • mysql> use wordpress

  • mysql> select blog_id,path from wp_blogs;

  • Identify the blog_id of the blog in question (in my example: 5)

  • Carefully issue
    UPDATE wp_5_posts SET guid = REPLACE(guid,
    '/oldname/',
    '/newname/');

    (test a SELECT first first if you're uncertain)


Step 2: Reactivate the permalinks (this is the undocumented voodoo step)

  • In Wordpress, go to "Settings" for the new blog, click "Permalinks" and then without any changes click "Save changes". That's the trick that did it for me!


Glitch 2 (minor): Others still point to your old URLs (and even yourself)

Remedy: Redirect your blog

  • Log in on the server

  • Go to /var/www and the relevant subdirectory where your blog resides, such as /blogs.yoursite.com

  • Open .htaccess

  • Add "Redirect 301 /oldname http://blogs.arno.fi/newname"


Test it -- it worked for me!

2 comments:

  1. [...] Ganz reibungslos ging der Namenswechsel nicht. Auf Englisch habe ich darüber näher berichtet. [...]

    ReplyDelete
  2. [...] friktionsfritt gick namnbytet inte. På engelska har jag redogjort närmare för [...]

    ReplyDelete