Changing URL schemes in wordpress without breaking old URLs

I started a blog and after a couple posts decided I didn’t like the /2009/03/26/foo-bar scheme for URLs (I changed to just /foo-bar). But for the couple posts posted before I changed this, I want to add rewrite rules so the old URLs don’t break.

I’ve tried every variation of the following I could think of in the .htaccess file, to no avail: (note that everything here except the “first-post” and “second-post” lines is wordpress boilerplate)

Read More
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteRule /2009/03/25/first-post /first-post
RewriteRule /2009/03/26/second-post /second-post

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Any ideas?

Related posts

Leave a Reply

3 comments

  1. A hacky solution that I just tried that works is to actually create the directories and subdirectories 2009/03/25/ etc and then add an index.php file containing the following:

    <?php
    header('Location: http://example.com/first-post');
    ?>