views:

194

answers:

3

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)

# 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?

A: 

Try

RewriteRule ^\d*/\d*/\d*/(.*) /$1
sysrqb
Doesn't work! I like the generality of the solution if it did work though. :)
dreeves
A: 

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');
?>
dreeves
Turns out this solution is really not viable since it screws up the tracking of statistics on readers that feedburner does.
dreeves
+1  A: 

Try the Permalink migration plugin from Dean Lee.

NickD