Removing Dates on Old Wordpress Blog URLs and Redirect Expressions

Discussion in 'Apache' started by everett sizemor, Jul 24, 2007.

  1. #1
    I want to kill the dates and post ids in the URLs on one of my blogs. I can easily get them to rewrite by changing permalinks structure in WP admin, but I can't get them to redirect. I SUCK at regular expressions, and have tried a few variations in my htaccess file, but none of them seem to work.

    Can anyone write one that basically just takes

    *wildcard-year/*wildcard-day/*wildcard-postID/ and just strips them out so what you end up with is a 301 redirect from that to this: /blog/post-title-only/ ?

    To be clear, I want to redirect this:
    http://www.domainname.com/blog/2006/08/02/post-title/
    To This:
    http://www.domainname.com/blog/post-title/

    Again - I can get the pages to reWRITE. I just can't get the old URLs to reDIRECT automatically. I could put in the redirects one-by-one but this blog has been around for years and that would take forever.

    Without the redirect if I update the permalinks structure in Wordpress, all the URLs change just fine, but when you go to the old URL it spits out a 404 instead of redirecting to the new URL.

    Thanks for the help! :D
     
    everett sizemor, Jul 24, 2007 IP
  2. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0