Your permalink structure is important for SEO. Having extraneous numbers (for the date) or post IDs in the URL of your posts can negatively impact your ranking in search engines. Plus, even if your content is timeless, the date in the URL may give the impression that the article is stale – which could result in fewer people clicking on your links. So here’s how I safely updated my permalinks in under two hours.
I started my blog in 2006 and back then, I thought it would be cool to list the full date in the URL. Well, times have changed and I wish I just kept the post title. I’ve wanted to fix this for a while but put it off because it seemed tedious (I have over 500 posts). Thankfully, I figured out a safe and easy way to do this using the free Redirection Plugin for WordPress. It took me about two hours to do everything.
Here’s what you need to do at a high-level:
- Install the latest version of the Redirection Plugin on your site.
- Create a staging version of your site to test it out.
- Update the permalinks structure on the staging site.
- Add an entry to the redirect plugin on the staging site.
- Validate that the redirection is working on the staging site.
- Repeat the last three steps on your live site.
- Monitor your live site for any errors.
Installing the Redirection Plugin:
Go to Plugins in your WordPress dashboard and click on “Add new.” Then type “Redirection” in the search box. You should find something that looks like what you see below:
From there, follow the steps to install and configure it. You want to do this first as you want your staging site to be configured the same as your live site.
Create a staging version of your site:
If your hosting plan includes a staging site, follow their instructions to set one up. I needed some assistance from support for setting it up as it was my first time doing it on their service. Also, my blog is on a sub-domain, so there was more than just the “1-click” setup that my hosting company advertises.
If you don’t have a staging site, you can always back up and restore your site to an inexpensive hosting plan to do the testing. If you’re not sure which approach to take, please feel free to contact me and I can help set you up with this.
Update the permalinks structure on the staging site:
You can find “Permalinks” under settings on your staging site. Simply select the format you want to use and then “Save changes.”
Add the entry to Redirection on the staging site:
Redirection can be found under “Tools.” You’ll want to create a new Redirection. Now, this is the hard part – you’ll need to enter the correct regular expression for the permalinks. This is where you need to do some research and trial & error. I found the below worked for me for changing from day & name to Post name:
So you can copy & paste, here’s what I typed in:
Source URL: /(\d*)/(\d*)/(\d*)/([A-Za-z0-9-]*)
Target URL: /$4
You need to ensure that you don’t have any spaces in either of the above URLs.
Validate that it’s working:
Now you need to go to your staging site and test out some URLs. Find posts that link to other posts on your site and click around. Note the URLs in the address bar. If it all looks good, then you’re ready to move forward.
Make the changes on the live site:
Okay, this is the scary part, but since you did it on the staging site, you’re probably okay with your live site. But, to be extra cautious, take a backup of your live site before you do anything else. Once that’s complete, follow the last three steps you did on your staging site (update permalinks, add redirection, and validate).
Pro Tip: Open up three tabs for this last part: one each for the permalinks, redirection, and a page you can validate. This way, you have everything queued up so you’ll minimize any downtime.
Monitor your site for 404 errors:
Redirection has logs to show you which pages are being redirected and which have errors. Keep an eye on this and fix any broken URLs that you come across.
This is task that requires some intermediate WordPress skills, so if you aren’t comfortable, hire a professional to do it. If you’re not working with someone that can help you, I’d be happy to do this for you – just contact me.
Best of luck.