A lazy web request about Apache rewrite rules

I’ve finally gotten around to porting my old Radio archives over to WordPress. One unintended consequence is that the urls for the individual daily archive entries change. In Radio the archive entry for today would be http://www.mcgeesmusings.net/2007/05/14.html; In WordPress the url becomes http://www.mcgeesmusings.net/2007/05/14 .

Google searches that point to an old Radio url end up with a 404 not found error. This seems to be a case where Apache’s rewrite rules should help, but I don’t know how to write the right rule off the top of my head. I could do my usual combination of searching for clues and trial and error. Perhaps someone out there could point me in a productive direction in the comments.

4 thoughts on “A lazy web request about Apache rewrite rules”

  1. RewriteEngine On
    RewriteRule /(\d\d\d\d\/\d\d/\/\d\d)\.html /$1

    Very simplistic, but should do the trick for URLs of the form you mentioned.

    If you just want to get rid of .html at the end, you can use:

    RewriteRule /(.*).html /$1

    Grig

  2. thanks for the quick idea – I will try it out tonight or tomorrow – depending on my schedule

Comments are closed.