Chris, a former client whose WordPress website I worked on several years ago, contacted me recently about an unexpected error message on their WordPress dashboard.
The issue was due to their infrastructure, but Chris didn’t know how to resolve the issue.
It was a PHP version issue. Could I take a look at it and resolve the issue?
And could I take a look at the site’s performance?
Chris was speaking at a conference in a few months and wanted to make sure the site was in tip-top condition for performance.
Sure, I replied to Chris.
I resolved the PHP version issue quickly.
But when I looked into site performance, and what steps I could take to improve it, I met a barrier right from the start.
It had to do with the permalink structure my client had on their website.
Read on to learn what I discovered and how the issue was resolved.
My Client’s Website Background
Chris’s WordPress website is over 10 years old with 900+ posts. But doesn’t have a custom permalink structure.
Which means the site has URLs like https://www.ourcompany.com/cat=264
for categories (used in their main menu) and https://www.ourcompany.com/?p=60
for posts.
Not very reader-friendly URLs, are they?
How I Approached the Issue
My first step for Chris’s project: testing the site in Google PageSpeed Insights.
I needed a performance baseline.
No surprise to me, based on what my client had told me about their site. The results were: the site performed poorly.
One of the PageSpeed recommendations was to consider caching.
Which couldn’t be done, because Chris’s site doesn’t have a custom permalink structure.
I knew the first step was to create a more meaningful post name URL structure by switching to a custom structure.
What worried me was, how to do it?
You change the permalink structure quickly in the Dashboard, using Settings > Permalinks.
What worried me was what happened after that change.
I know about setting up 301 redirects, so anyone visiting the old URL structure, or who might have bookmarked a page with the old permalink structure, would be redirected seamlessly to the new URL.
And I’ve set up URL redirects in the past, for less than 20 pages on a site.
But not with sites that required 100’s of redirects.
What regex would I need to create?
Could I set up the 301 redirects with a plugin? Would it make more sense to do it in the .htaccess file?
Default Permalinks Redirect Automatically to Custom Link Structure
As it turns out, there was no extra redirect work on my part.
After some research, I learned that when you change your WordPress default URLs to a custom link structure, the links are redirected automatically to the new structure.
What a pleasant surprise!
I didn’t know that when I started the project.
It’s only a problem when switching between two different custom structures.
And I didn’t need to set up 301 redirects for incoming links. It’s all handled automatically by WordPress.
Phew!
Summary
Changing from the default URL structure to a custom link structure in WordPress is automatic. There’s no work on your part.
Despite working with WordPress since 2006, it never fails.
I always learn one new thing on every WordPress project I work on.
Did you know that default permalinks redirect automatically to a custom link structure? Share your experience in the comments.