The Right Way To Change Your WordPress Permalink

When I changed my WordPress permalinks, I’m start getting many 404 errors from Google Webmaster Tools. This is because Google still get the old permalink of this blog. I changed my permalink from

/%category%/%post_name%/%id%

to just

%post_name%

since it is more Search Engine friendly URL.

I’m getting around 400 pages because of this 404 Errors. And after looking into some solution on the web, what i need is redirect all the old URL to new permalink. I found the smart way by using htaccess. Thanks to Yoast.com that made the very handy script to generate the 301 redirect from htaccess. You can generate it here.

And this is my htaccess link sample:

RewriteEngine On
RewriteBase /
RedirectMatch 301 ^/([^/]+)/([^/]+)/(\d+)/$ http://www.ivankristianto.com/$2
RedirectMatch 301 ^/([^/]+)/([^/]+)/([^/]+)/(\d+)/$ http://www.ivankristianto.com/$3
RedirectMatch 301 ^/(\d+)/(\d+)/([^/]+)/$ http://www.ivankristianto.com/$3

So now, all my old permalink will automatically redirect to new permalink with that simple tricks.

If you like this post and would like to give feedback, please let me know from the comment below.

Give me your feedback

This site uses Akismet to reduce spam. Learn how your comment data is processed.