What is a redirect?
Redirects are instructions or methods that automatically take visitors of one file to another file or location. They are accomplished in many ways. Each way hurts your pagespeed.
How do redirects affect page speed?
Have you ever asked where a bathroom is and when you go there you are told that this bathroom is closed and you have to go to some other bathroom? It is like that. Redirects cause your pages to load slower because it is a waste of time to go to one place just to be redirected to another.
As more and more people use mobile, redirects will become more and more of a problem. Any website that has implemented a mobile seo solution recently should pay close attention to the redirects happening on their pages. Redirects affect mobile users a great deal as they are using less reliable mobile networks than your desktop users.
There are many good and legitimate reasons to have redirects but it should be kept in mind that redirects cause significant performance and speed issues.
Every single redirect you can remove (or clean up) will make your pages load faster.
If you do not use any redirects, you are serving your content significantly faster. Redirects are likely the one single most time waster in your code especially when you consider mobile networks. They dramatically affect your page speed in a noticeably bad way.
Server-side redirects: Fast, cachable
Common redirects are 301 and 302 redirects which use HTTP to explain that a page or resource has moved. A 301 redirect is permanent and a 302 redirect is temporary. These are both server-side redirects which means that the web server is using HTTP to direct the browser to the new location of the file. Web browser can handle these types of redirect much quicker than client-side redirects and can cache the correct location of the file.
Client-side redirects: Slow, not cachable
You very likely do have some. Perhaps one of the most used redirects on the web is 301 redirect site wide from the non-www to www version of a webpage. These types of redirects have been recommended for SEO reasons for years so many people have them.
It is my recommendation that if you have this type of redirect, you keep it in as it helps Google understand your website better.
How to check for redirects?
You can check for redirects on your pages by using the redirect mapper tool (it detects and displays 301 and 302 redirects).
It is a good time to check all your pages redirects and see where they are on your site and think about how to change them, or if they are important enough to slow down your pages.
Recommendations from Google
Google suggests eliminating redirects which are not absolutely necessary. They advise reducing redirects by…
- “Never link to a page that you know has a redirect on it. This happens when you have manually created a redirect, but never changed the text link in your HTML to point to the new resource location.”
- “Never require more than one redirect to get to any of your resources.”
Don’t forget that your webpage isn’t just loading HTML
Virtually all webpages require other things to load. You may think you have no redirects in your HTML, but what about your CSS files, images or external scripts? Make sure you know what resources your page is calling as it loads. Use the page speed tool to do so.
Make sure all resources are being called in a manner that does not create a redirect. (Example – If your site is using “www” make sure you are calling your css and other files using “www”.)
Check for old redirects
You may want to check your .htaccess file or other server configuration files for old legacy redirects. These are redirects that were maybe added for a certain page or a certain section of your website. They can really add up and won’t always be easy to discover without looking for them. I have encountered many websites that still have redirects for old content that does not even exist anymore.
There is a best practice of sorts that I follow when removing redirects…
- Find redirects
- Understand why redirect exists
- Check to see how it affects / or is affected by other redirects
- Remove if not needed
- Update it if it affects / is affected by other redirects
- If your site is secure, consider using HSTS to remove the ssl redirect
Cleaning up redirect chains
More often than needing to remove a redirect is a scenario where you need to clean up a redirect chain.
An example of this is where you have redirected all your site to go from the non www version to the www version…
Then at a later time you redirected all your traffic to you https version.
In some scanarios you might be redirecting a user typing “example.com” to “www.example.com” and then that gets redirected to “https:www.example.com”. This happens often.
The solution for this is to make sure that the old site wide redirect does not go from non www to www, but rather from non www to https://www (or whatever your situation may require). The point is to make sure your site wide redirects make sense and are current.
When was the last time you typed “www”? (a long time ago) When was the last time you did that on your phone? (never).
Another example of a redirect that needs some cleaning is similar to above but are specific to certain pages. Let’s say you have all the redirects I describe above, but years ago you made 301 redirects for a few certain pages. Those old redirects are likely pointing somewhere where they are just getting another redirect.