Redirect Ugly Permalink to Postname

by Hiroshi on November 21, 2008

in Hacks, WordPress

Most of the blogs, even popular blogs have their permalink structure like:

WordPress Offers following permalink structures: (Default) (year/month/day/postname) (year/month/postname) (numeric)
and custom permalink structure

The recommended one by SEO experts is following:
Which can be achieved by putting /%postname%/ in custom permalink box from your admin area under permalinks.

Many bloggers will not switch to recommended permalink because they have got backlinks for their old permalink. If you are still using the ugly /%year%/%month%/%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 change permalink structure from your admin area.
Go to Permalinks
Select custom
Fill out the field with /%postname%/

Now we have 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 installation root directory.

Paste the following line in your .htaccess:

RedirectMatch 301 /([0-9]+)/([0-9]+)/([0-9]+)/(.*)$$4

Congrats! You just changed your permalinks structure without loosing any backlinks! Cheers…

Related Posts

Previous post:

Next post: