Seamless Permalink Updating

by Rick Beckman on January 13, 2008 · 11 comments

in Journal

Update: The solution to the problem in this post has been found and posted.

I wish I would have set up the permalink structure here properly months ago when I started blogging. Now I want to change it, but if I am not careful in doing so, I’m effectively losing any external links to my posts, particularly those the search engines have linked to.

What I mean is, I want to go from this:

http://rickbeckman.org/2008/01/08/refactoring-rickbeckmanorg/

to this:

http://rickbeckman.org/refactoring-rickbeckmanorg/

without making the first link ineffective.

I know this can be accomplished via mod_rewrite, but I’m by no means savvy enough to figure it out. I’ve experimented, I’ve read all about regular expressions, but I have as of yet been unsuccessful at wrapping my mind around the concepts involved.

I do know that I need to rewrite /number/number/number/text-numbers-hyphens/ to simply /text-numbers-hyphens/.

Seems simple enough, but for all its wonder, mod_rewrite is strange voodoo.

Anyone reading this skilled enough to lend me a hand? I asked on the WordPress support board, but I did so noting that several other users with similar questions haven’t received any real help in ten or more months. Needless to say, I’m not holding my breath either.

Enhance Your Blog with Thesis

What do you look for in a WordPress theme? Loads of options? Unsurpassed support? A beautiful base style?

Look no further than Thesis, the premier WordPress theme framework from the one and only Chris Pearson.

Rock solid semantics. Bulletproof search engine optimization. Crystal clear typography. And more options than you can shake a stick at. What are you waiting for? Get Thesis today!

11 responses in this conversation. Join in!

1 Chris January 13, 2008 at 1:26 pm

I’m probably at the same point as you as far as understanding mod_rewrite. I played with it a couple years ago and ended up messing up all my links and my photo gallery (should have done a test site like you…lesson learned). I’ll let you know if I run across anything that can help you out. It’s strange voodoo indeed…

Curious…why the change? Speed up the site?

2 Rick Beckman January 13, 2008 at 2:47 pm

Actually, the change will have a twofold effect:

1) The URLs will be more attractive to human users — example.com/article/ is a lot nicer than example.com/year/mo/da/article/. Just seems cleaner, perhaps more professional. Though admittedly, that’s quite subjective!

2) The date of the post adds nothing of value for search engines; removing it will increase the power of whatever is left in the URL, concentrating the power of the keywords present, so to speak. I’m a sucker for SEO tips like that, I suppose. :)

3 Jeff_ January 16, 2008 at 6:21 pm

I recently contemplated doing the same thing, but voted against it primarily because I felt the hassle just wasn’t worth the payoff, which, unfortunately, is probably not much. Nonetheless, I am going to look into a “clean” way of doing this via htaccess as soon as possible. If/when I am able to cobble something together, you will be the first (- er, second) to know. ;)

4 Rick Beckman January 17, 2008 at 7:36 am

As I stated over at your place, I will be greatly appreciative! It’d be nice to have a real solution to this problem, whether the payoff is substantial or not. :D

5 Donace January 17, 2008 at 3:16 pm

not sure what version (think it was 2.3) my mate had running on his site and he had similar permlinks.

I was snooping at his backend and found that you could add a custom setting.

I set it up as /%category/%title and it ended by having url’s as follows:

Post
http://example.com/funny-videos/light-sabercarefull

Category
http://example.com/category/blondes-jokes

A few kinks as you can see by the second url but i hope to iron these out and will experiment later with htaccess but my knowledge is limited but i will let you know if i find the grail.

6 Rick Beckman January 17, 2008 at 8:29 pm

Donace — Changing the permalinks the system creates is quite easy, yup. The problem I have is that as soon as I change my permalink structure, any links which reference the old style — including those within search engine indexes — will be invalidated. I’m looking / hoping for a way to seamlessly redirect any requests for old style permalinks to the new style, which I hope to implement soon.

7 Jeff_ January 20, 2008 at 11:17 am

Looks like you beat me to the punch! Your permalinks look much cleaner now, I must admit.. How has the htaccess code been working? Any issues? Have you examined your 404 error log since the change? I may just have to rethink my permalink strategy (again) after all..

8 Rick Beckman January 20, 2008 at 2:04 pm

Jeff_ — Actually, I never checked Apache’s error log until I implemented this change; I’ve been checking it pretty much daily since doing so!

And so far, everything has been working great. What is a mystery to me is how the permalink to the post RickBeckman.org » Kingdom Front works; the permalink to it contains two percentage signs, which wouldn’t be caught by the regex I’m using. Yet the permalink seems to work just fine, so I’m not getting worked up about it by any means.

9 Nikhil Gupta May 18, 2008 at 12:24 am

hey rick, there is a small problem i am facing here…
I use google webmaster… and it still shows me indexed sites from the time when i was just setting up my blog, (i mean i was experimenting from Joomla, wordpress, etc) later, i used wordpress with no permalink updates.. now google webmaster shows me links from the Joomla time, as well as Wordpress’s non-seo permalinks… how to delete the Joomla links and how to update those wordpress links to the current ones…
Please help me…

Latest from Nikhil Gupta: 1000 Megauploads Links’ List!

10 Nikhil Gupta May 18, 2008 at 12:25 am

I m sorry… dont wanna spam… but did my comment went through….???

Latest from Nikhil Gupta: 1000 Megauploads Links’ List!

11 Rick Beckman May 18, 2008 at 4:22 pm

Nikhil Gupta: Removing content from Google can be done in a variety of ways, but all of them will take place at Google’s own pace as its crawler discovers that the content is missing or forbidden:

http://www.google.com/support/webmasters/bin/answer.py?answer=64033&topic=13511
http://www.google.com/support/webmasters/bin/answer.py?answer=61062&topic=13511

As far as getting your new content indexed, if Google’s crawler can crawl your site using the new address structure, those addresses will be indexed.

The addresses your site used prior to the permalink settings were like this, correct?:
http://isthisnikhil.com/?p=4

If that’s the case, try visiting that old address; it redirects to the new structure just fine, so Google should see that when it tries browsing your older style addresses and it will update accordingly.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous post: Refactoring RickBeckman.org

Next post: “American Pie”: An Intro to Ron Paul