In this article you will get to know about
- Meaning of "Avoid landing page redirects"
- How to fix it
The Problem
When "PageSpeed" detects you have more than one redirect from the given URL to the final landing page then a warning will appear "Avoid Landing Page Redirects".
To illustrate, the redirect chain can appear like this,
Example.com -> https://example.com -> https://www.example.com
Required version should be like this,
Example.com -> https://www.example.com
The redirection activates one additional HTTP request response cycle and therefore delays page rendering. There may be a case when it results in multiple round-trip request-response cycles including, DNS lookups, TCP handshake and TLS negotiation.
The Reason
There may be many reasons you are considering redirects:
- Original site has been moved and you wish to send the user to the current site.
- In order to track clicks and log pages that refer users to your site.
- In order to reserve multiple domains
- In order to secure the information you are sending and receiving by switching from HTTP to HTTPS.
Even if site redirection takes place due to some reason, care should be taken to implement it in such a way that your users see as little delay as possible.
Let us suppose an address of website http://www.exmple.com that takes 365ms to load completely. However, when the same site is loaded using slightly different address which is http://example.com .
Then, the request is completed in two steps. The first step calls http://example.com which takes 158 ms and we are then redirected to http://www.exmple.com which took 365 ms. Due to redirection the total HTML request, download and render time took extra 156 ms for a total of 521 ms.
Problem in Mobile Version
The redirects are more noticeable on mobiles because of slower networks. If your website runs on a mobile version, but on any other domain, subdomain or subfolder. There will be unnecessary redirects for all the mobile users.
For instance,
Example.com -> m.example.com
Or, another case may be,
Example.com -> www.example.com -> m.example.com
Solution for Mobile Version
The simple solution is to make your site responsive such that the same content is displayed on all the devices just scaling and styling can be different as per the device width.
Optimize the use of Redirection
Redirects can be fixed using one of the following ways:
- HTTP Redirect
- Javascript Redirect
Recognize the redirects to access Non-HTML resources
Non-HTML Resources
It is equally important to check if your site requires external files, such as images and CSS. Make sure that HTML calls these files directly and there are not any redirects occurring to download these files.
Use of Slashes
There is something to consider is that one with the trailing slash is considered a directory and without a slash indicates a file.
Directory: http://example.com/foo/
File: http://example.com/foo
Although many sites do not distinguish between the two sites but search engines do see them distinctly. To identify the URL redirects, check to confirm which is returning an HTTP response code of 200 and which returns the HTTP response code of 300.
How to fix the redirects?
HTTP Redirects is the solution.
Using this users are sent to device-specific sites. This can be accomplished by setting the user-agent in the HTTP request headers. The response code for HTTP redirection is either 301 (This specifies that the redirection is permanent) or 302 (This specifies that the redirection is temporary).
Your task is to identify which URL garners the most traffic and then configure an HTTP-301 type redirect for all the less used URL’s to the most trafficked. Access your server's htaccess file to implement the changes.
Avoid HTTP redirects and Stay fast.