Tutorial :Changing URL schemes in wordpress without breaking old URLs



Question:

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?


Solution:1

Try the Permalink migration plugin from Dean Lee.


Solution:2

Try

RewriteRule ^\d*/\d*/\d*/(.*) /$1  


Solution:3

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');  ?>  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »