This blog has been live for well over 4 years now and during this time I have had change permalinks a number of times. From the default “/?p=123” to “/%postname%.html”, I never really bothered about SEO effect or pages returning 404 error or users complaining. This was true when there wasn’t much of traffic and neither was there an element of seriousness about blogging.
However, 4 years later, a lot has changed, more traffic, a large user base and acceptable search engine rankings. Now that I have learned that “/%postname%/” is what I should have opted for, I was searching for an easy to change permalinks. Yoast has a great article about doing the same but for me, the steps listed there didn’t work, even though the articles were being redirected properly but the homepage was returning 404 error. Damn, I said, and continued to find the best way out.
I am listing down the steps I followed to change wordpress permalink structure and in the way handling 301 redirects as well:
- Install Redirection Plugin from wordpress repository.
- Activate the plugin.
- Under Tools -> Redirection, you’ll get access to Redirection settings, open it.
- Enter the following values:
- Source URL – “^/([^/]+).html$”
- Target URL – “$1”
- Check the “Regular expression” option (since we are using one!)
- Now simply click on “Add Redirection” button and we are ready to make the transformation.
This was about preparing Redirection Plugin to handle 301 redirects. Now we need to make the permalink change in wordpress installation. In case you are not aware of the steps, continue reading:
- Go to Settings -> Permalinks
- Choose “Post Name” radio box under “Common Settings”
- Click on “Save Changes”.
That’s it! You are now good to go. Flush the cache before testing the working of all links. With this you’ll not be losing the link value of existing URL’s; traffic from search engines or getting 404 error pages.