• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Michele Neylon :: Pensieri

Michele Neylon :: Pensieri

Technology, Marketing, Domains, Thoughts

Fixing Permalinks With Mod_Rewrite

August 11, 2011 by Michele Neylon Leave a Comment

I’ve posted a couple of times about the migration from MovableType to WordPress (and all the other moves that preceded it).

One of the things I discovered via the “Redirection” logs was that I was losing quite a bit of traffic due to some “anomalies” and differences between how the permalinks are currently set and how they’d been when the site was using MovableType.

While I might have wanted people and search engines to always refer to posts using something like:

domain.tld/postlocation/

a lot of them had picked up on the index page, so they’d got:

domain.tld/postlocation/index.html

While that was fine in MovableType and would work fine, it was causing me headaches in WordPress, as that was not how I’d setup the permalinks, nor did I want to set them up that way.

I’d also got a few posts that had a completely different URL structure to the rest of the site, which was odd and quite annoying, but again, as MT stored the posts as actual files it didn’t matter too much. In the worst case scenario two versions of the same post might be available – and duplicate content will beat a 404 error any day of the week in my book 🙂

I tried to fix these anomalies, but while I managed to get various wordpress plugins to fix the bulk of them I was still left with a bunch of errors..

So Niall came to the rescue. He’s a bit of a wizard with regular expressions and mod_rewrite

Here’s the two rules he added that fixed all my problems (or enough of them to keep me quiet – WordPress’ insistence on putting apostrophes back into URLs isn’t something I can fix easily!):

RewriteRule ^/blog/archives/([0-9]{4})/([0-9]{2})/([0-9]{2})/(.*)/ /blog/archives/$1/$2/$4/ [L,R=301]
RewriteRule ^/blog/([0-9]{4})/([0-9]{2})/(.*).html$ /blog/archives/$1/$2/$3/ [L,R=301]

Thanks Niall!

Related articles
  • A Couple of WordPress Plugins and Tips To Help With Migration (michele.me)
  • Site Revamp (Sort Of) (michele.me)

Related Posts:

  • computer-code-screens
    Dodgy WordPress Developer Tactics
  • taylor-swift-eras-tour-paris
    Female Rage : The Musical (Taylor Swift in Paris)
  • ed-sheeran-live-zagreb
    2025 Concerts and Performances
  • Video thumbnail for youtube video 5wsw3iwrja0
    American English vs English
  • Hans Zimmer concert in Madrid 2023
    Another Year of Fun Concerts
  • wine-prices
    Wine Is Confusing

Filed Under: blogging, wordpress Tagged With: movabletype, Uniform Resource Locator, wordpress

Michele is founder and CEO of Irish hosting provider and domain name registrar Blacknight. Read More…

Reader Interactions

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

dotblog founder

Mastodon

Archives

  • Bluesky
  • Instagram
  • Threads
  • Twitter

Pages

  • About Me
  • About This Site
  • Archives
  • Comments Policy
  • Contact Me
  • Newsletter
  • Privacy

Blogroll

  • Gordon Hudson
  • My Mastodon
  • Technology.ie Podcast
  • Paul Savage – BlackDog SEO
  • Grandad

Stalking Links

Subscribe to Michele Neylon :: Pensieri

Blogroll

  • Blacknight Blog
  • Damien Mulley
  • Gianni Ponzi
  • Gordon Hudson
  • Grandad
  • My Mastodon
  • Paul Savage – BlackDog SEO
  • Stewart Curry
  • Technology.ie Podcast
  • Tom Doyle

Sites

  • Business Travel Tips
  • Discount Coupon Codes
  • Domain News
  • Fat.ie – my diet blog
  • Film Posters
  • Film Reviews
  • Films
  • Free Desktop Wallpapers
  • Irish Blogger Discussion Forum
  • Irish Stamps
  • Movie Trailers and News
  • Paste.ie

Footer

Site hosted in Ireland by Blacknight - Content copyright Michele Neylon

Copyright © 2025 · Magazine Pro on Genesis Framework · WordPress · Log in