Redirect Day and name permalinks to postname

November 7, 2008 · Print This Article

If you use the ugly /%year%/%monthnum%/%day%/%postname%/ permalink structure, you should be interested to know how you can switch to the elegant /%postname%/ structure without loosing any backlink, using a simple .htaccess redirection.

The first thing to do is to login to your WordPress admin, go to Settings → Permalinks and select custom. Fill out the field with /%postname%/.
Your permalinks will now look like the ones on this blog:
Now we got to redirect all backlinks using the old permalinks structure to the new permalink structure. To do so, you’ll have to edit the .htaccess file, located in WordPress root directory.
Be careful while editing .htaccess: Always create a backup before!

Paste the following line in your .htaccess:
RedirectMatch 301 /([0-9]+)/([0-9]+)/([0-9]+)/(.*)$$4
Allright! You just changed your permalinks structure without loosing any backlinks!

Your choice for site templates and wordpress themes


Got something to say?

You must be logged in to post a comment.