If you’re redesigning your website, changing your website structure, or updating old content, you’ll want to set up redirects so you don’t lose traffic.
Keep reading this blog to learn best practices around redirects, and how to minimize redirects in WordPress.
What is A Redirect?
A redirect is a way for users and search engines, such as Google, to get to a web page with a different URL than they originally requested. Sometimes a URL changes, or a page is taken down. A redirect is set up to take users to another page with a different URL. This provides a better user experience.
When setting up redirects, you’ll want to follow search engine optimization (SEO) and WordPress best practices.
Why Is It Important To Minimize Redirects In WordPress?
Redirects can impact your website’s performance in a number of ways. Because of that, it’s important to minimize redirects in WordPress.
When you incorrectly type in a URL, WordPress automatically redirects you.
For example, if your page is at example.com/mall/food-court but you incorrectly type in example.com/food-court — WordPress is smart enough to send you to the right location.
Unfortunately, it doesn’t always work as planned. One example is when you have http to https. Another example is when you have www to non-www.
The following could end up happening to your visitors:
- Step 1: The visitor is redirected from http to https
- Step 2: The visitor is redirected from non-www to www
- Step 3: The visitor is redirected from food-court to mall/food-court
- Step 4: The page loads
This makes development easy but it has its pitfalls:
- Google punishes you for each redirect
- Site speed suffers from redirects
- A redirect loop can occur
How To Minimize Redirects In WordPress
There’s a number of things you can do to minimize redirects in WordPress. You can use various online tools to check your page. Check out our article on debugging redirects. You can also use GTmetrix to find them https://gtmetrix.com. With GTmetrix, you’ll see something like this when you test your site:
- Go to the Structure section
- Open the Avoid multiple page redirects section.
Here you can see the problem:
- Step 1: http://example.com 177ms
- Step 2: https://example.com 235ms
- Step 3: https://www.example.com 152ms
These redirects took a total of 564ms. That’s almost half a second. While half a second may not seem like a big deal, issues like this do affect your Google ranking and your user experience.
In this example, you only see issues with the home page redirecting. But, you may have linked resources redirecting as well. If you stack all of these issues together, they can add up to multiple seconds of wait time. GTmetrix will show you all of the redirecting resources.
How To Fix And Minimize Redirects
First of all, double check that links on your site are updated to the correct URLs.Make sure that all of your resources on your page are linked to the final destination.
Secondly, you’ll want to make sure that what’s in your database matches what’s in Google and the other search engines.
For example, let’s say Google has you indexed as: https://www.example.com
But you have in your database:
It should be:
Need help? Host with us and get best of class hosting support.
How To Minimize Redirects With A WordPress Plugin
If you’re redesigning or restructuring your site, you’ll want to map your old urls to the new urls. You can do this with a WordPress redirect plugin. Redirection is a good example of one.
While you can minimize redirects with the WordPress plugin, it does have its limitations. You still will want to set up a canonical domain redirect. For that, we use .htaccess. You’ll have to choose which option works best for you.
Option A: Force non www. version and https
Option B: Force www. version and https
Note: It’s recommended to use https on your entire site but, if you don’t want to, you can do the same thing for http using the options below.
Option C: Force non www version and http
Option D: Force www version and http
These will not only do 2 redirects at the same time, they will also redirect all of your sub-pages. The $1 is what handles the sub-page redirect.
As I stated previously, if you’ve redesigned your site or changed its structure, you’ll want to redirect those pages as well. You can either do this part in the WordPress plugin to minimize redirects or you can do this in .htaccess using the code below.
You’ll typically want to use 301 redirects. However, if you’re temporarily moving a page, you’ll want to use 302 instead of 301.
Too Many Redirects
If you notice this error, check out our Too Many Redirects article.
Other Issues Affecting Redirects and Performance
If you’re running outdated WordPress, plugins, or themes, you can get errors like unnecessary redirects. However, installing updates can also break things. Read our article for best practices on updating your WordPress website safely.
You may at times need to put your WordPress site in maintenance mode during updates. Read our blog to learn how to put your WordPress website into maintenance mode.
Sometimes, you’ll need to clean up your site to remove malicious redirects. Check out our blog on WordPress cleanup for recommendations there.
Consider Hosting Your WordPress Site With Nexcess
Now you know how to reduce the number of redirects on your WordPress website to improve page speed and rank higher in search engines like Google.
Choosing a host like Nexcess for your site can also boost page speed, help you rank higher, and keep your site secure.
Explore our many WordPress hosting plans to get started today.