Seamless Permalink Updating

Update: The solu­tion to the prob­lem in this post has been found and post­ed.

I wish I would have set up the perma­link struc­ture here prop­er­ly months ago when I start­ed blog­ging. Now I want to change it, but if I am not care­ful in doing so, I’m effec­tive­ly los­ing any exter­nal links to my posts, par­tic­u­lar­ly 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/

with­out mak­ing the first link ineffective.

I know this can be accom­plished via mod_rewrite, but I’m by no means savvy enough to fig­ure it out. I’ve exper­i­ment­ed, I’ve read all about reg­u­lar expres­sions, but I have as of yet been unsuc­cess­ful at wrap­ping my mind around the con­cepts involved.

I do know that I need to rewrite /number/number/number/text-numbers-hyphens/ to sim­ply /text-numbers-hyphens/.

Seems sim­ple enough, but for all its won­der, mod_rewrite is strange voodoo.

Any­one read­ing this skilled enough to lend me a hand? I asked on the Word­Press sup­port board, but I did so not­ing that sev­er­al oth­er users with sim­i­lar ques­tions haven’t received any real help in ten or more months. Need­less to say, I’m not hold­ing my breath either.

11 thoughts on “Seamless Permalink Updating”

  1. I’m prob­a­bly at the same point as you as far as under­stand­ing mod_rewrite. I played with it a cou­ple years ago and end­ed up mess­ing up all my links and my pho­to gallery (should have done a test site like you…lesson learned). I’ll let you know if I run across any­thing that can help you out. It’s strange voodoo indeed…

    Curious…why the change? Speed up the site?

  2. Actu­al­ly, the change will have a twofold effect:

    1) The URLs will be more attrac­tive to human users — example.com/article/ is a lot nicer than example.com/year/mo/da/article/. Just seems clean­er, per­haps more pro­fes­sion­al. Though admit­ted­ly, that’s quite subjective!

    2) The date of the post adds noth­ing of val­ue for search engines; remov­ing it will increase the pow­er of what­ev­er is left in the URL, con­cen­trat­ing the pow­er of the key­words present, so to speak. I’m a suck­er for SEO tips like that, I suppose. :)

  3. I recent­ly con­tem­plat­ed doing the same thing, but vot­ed against it pri­mar­i­ly because I felt the has­sle just was­n’t worth the pay­off, which, unfor­tu­nate­ly, is prob­a­bly not much. Nonethe­less, I am going to look into a “clean” way of doing this via htac­cess as soon as pos­si­ble. If/when I am able to cob­ble some­thing togeth­er, you will be the first (- er, sec­ond) to know. ;)

  4. As I stat­ed over at your place, I will be great­ly appre­cia­tive! It’d be nice to have a real solu­tion to this prob­lem, whether the pay­off is sub­stan­tial or not. :D

  5. not sure what ver­sion (think it was 2.3) my mate had run­ning on his site and he had sim­i­lar permlinks.

    I was snoop­ing at his back­end and found that you could add a cus­tom setting.

    I set it up as /%category/%title and it end­ed by hav­ing url’s as follows:

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

    Cat­e­go­ry
    http://example.com/category/blondes-jokes

    A few kinks as you can see by the sec­ond url but i hope to iron these out and will exper­i­ment lat­er with htac­cess but my knowl­edge is lim­it­ed but i will let you know if i find the grail.

  6. Donace — Chang­ing the perma­links the sys­tem cre­ates is quite easy, yup. The prob­lem I have is that as soon as I change my perma­link struc­ture, any links which ref­er­ence the old style — includ­ing those with­in search engine index­es — will be inval­i­dat­ed. I’m look­ing / hop­ing for a way to seam­less­ly redi­rect any requests for old style perma­links to the new style, which I hope to imple­ment soon.

  7. Looks like you beat me to the punch! Your perma­links look much clean­er now, I must admit.. How has the htac­cess code been work­ing? Any issues? Have you exam­ined your 404 error log since the change? I may just have to rethink my perma­link strat­e­gy (again) after all..

  8. Jeff_ — Actu­al­ly, I nev­er checked Apache’s error log until I imple­ment­ed this change; I’ve been check­ing it pret­ty much dai­ly since doing so!

    And so far, every­thing has been work­ing great. What is a mys­tery to me is how the perma­link to the post RickBeckman.org » King­dom Front works; the perma­link to it con­tains two per­cent­age signs, which would­n’t be caught by the regex I’m using. Yet the perma­link seems to work just fine, so I’m not get­ting worked up about it by any means.

  9. hey rick, there is a small prob­lem i am fac­ing here…
    I use google web­mas­ter… and it still shows me indexed sites from the time when i was just set­ting up my blog, (i mean i was exper­i­ment­ing from Joom­la, word­press, etc) lat­er, i used word­press with no perma­link updates.. now google web­mas­ter shows me links from the Joom­la time, as well as Word­Press’s non-seo perma­links… how to delete the Joom­la links and how to update those word­press links to the cur­rent ones…
    Please help me…

    Lat­est from Nikhil Gup­ta: 1000 Megau­ploads Links’ List!

  10. Nikhil Gup­ta: Remov­ing con­tent from Google can be done in a vari­ety of ways, but all of them will take place at Google’s own pace as its crawler dis­cov­ers that the con­tent is miss­ing 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 get­ting your new con­tent indexed, if Google’s crawler can crawl your site using the new address struc­ture, those address­es will be indexed.

    The address­es your site used pri­or to the perma­link set­tings were like this, correct?:
    http://isthisnikhil.com/?p=4

    If that’s the case, try vis­it­ing that old address; it redi­rects to the new struc­ture just fine, so Google should see that when it tries brows­ing your old­er style address­es and it will update accordingly.

Leave a Comment

Your email address will not be published. Required fields are marked *

Use your Gravatar-enabled email address while commenting to automatically enhance your comment with some of Gravatar's open profile data.

Comments must be made in accordance with the comment policy. This site uses Akismet to reduce spam; learn how your comment data is processed.

You may use Markdown to format your comments; additionally, these HTML tags and attributes may be used: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Rick Beckman