2

How to Change Permalink Structure and Setup Redirects in WordPress

WordPress-Permalinks

Last month, I changed the month and year based permalink structure of TechTage to a simpler one based on just the post name. When I initially changed the structure from WordPress settings, I was quick to notice that old links were not working any more. With a quick .htaccess tweak, I was able to fix that and so far all my old URLs are 301 redirecting to the current ones. This was a lot easier to achieve than I had anticipated, and I’m going to show how you can do it too in this post.

NOTE:¬†This tutorial is only for switching from a different permalink structure to the simple %postname% structure. In some cases like when you’re switching from a less to more informative URL structure, you don’t actually have to setup redirects manually tweaking your .htaccess. WordPress automatically handles the job for you. Test (load your old URLs) before you proceed!

Here are the steps:

1. Choose the ‘/%postname%/’ Structure from in WordPress ‘Permalink Settings’

The title explains it all. You just check the box next to ‘/%postname%/’ and click on ‘save changes’ at the bottom.

wordpress-permalink-settings

2. Use Yoast’s Redirects Generator

The most useful tool for the purpose, hands down.

  1. Click on the green ‘generate redirects’ button at the bottom of the post.
  2. Input your site’s URL.
  3. Specify if your blog is running in a subfolder (such as /blog).
  4. Select your old permalink structure.
  5. Generate the code responsible for the redirect.

The code looks something like this:

Yoast-URL-Redirects-Generator

3. Modify Your .htaccess

The last step involves adding the previously generated piece of code to the .htaccess file of the root directory of your WordPress installation. You can do this via a control panel (like cPanel) or FTP.

This shouldn’t be hard. All you’ll need to do is to open the old .htaccess file, and add the code to the top of it (yeah, of course you need to save the changes!).

Mission Accomplished!

That’s pretty much all. A nice and easy way to introduce the next level of simplicity to your site’s URL structure, and it involves only three steps!

Let me know how it goes for you, in case you try this. Also let us all know if you happen to know about an even easier process to achieve the same result.

Rohit Palit
 

I'm a 19 years old Web Entrepreneur based out of Kolkata, India. I'm a technical SEO fanatic. I'm also interested in web hosting and WordPress. Want to get in touch? Connect with me on - My Personal Site, Google+, Facebook & Twitter.

  • Thank you Rohit, amazing tips and insights. The code worked instantly and all posts are as they should be. Huge fan!