PageSpeed: Avoid landing page redirects
Overview
Redirections on landing pages add delays to the page load and while the redirections are occurring, nothing is shown to the client. In many cases, redirections can be eliminated without changing the function of a page.
How does your site score on this recommendation?
What can I do?
If your service requires redirects, perform the redirection server-side rather than client side, in order to reduce client-side round trip requests. Minimizing HTTP redirects from one URL to another cuts out additional RTTs and wait time for users.
Details from Google
Round-trip time (RTT) is the time it takes for a client to send a request and the server to send a response over the network, not including the time required for data transfer. That is, it includes the back-and-forth time on the wire, but excludes the time to fully download the transferred bytes (and is therefore unrelated to bandwidth).
RTTs vary from less than one millisecond on a LAN to over one second in the worst cases, e.g. a modem connection to a service hosted on a different continent from the user. For small download file sizes, such as a search results page, RTT is the major contributing factor to latency on "fast" (broadband) connections. Therefore, an important strategy for speeding up web page performance is to minimize the number of round trips that need to be made. Since the majority of those round trips consist of HTTP requests and responses, it's especially important to minimize the number of requests that the client needs to make and to parallelize them as much as possible.
Sometimes it's necessary for your application to redirect the browser from one URL to another. There are several reasons web applications issue redirects:
- To indicate the new location of a resource that has moved.
- To track clicks and impressions and log referring pages.
- To reserve multiple domains, allow for "user-friendly" or "vanity" domains and URLs, and catch misspelled/mistyped URLs.
- To connect between different parts of a site or application, different country-code top-level domains, different protocols (HTTP to HTTPS), different security policies (e.g. unauthenticated and authenticated pages) etc.
- To add a trailing slash to URL directory names to make their contents accessible to the browser.
Whatever the reason, redirects trigger an additional HTTP request-response cycle and add round-trip-time latency. It's important to minimize the number of redirects issued by your application - especially for resources needed for starting up your homepage. The best way to do this is to restrict your use of redirects to only those cases where it's absolutely technically necessary, and to find other solutions where it's not.
Read our Lighthouse documentation to learn more on avoiding redirects.