PageSpeed : Avoid landing page redirects
Published by Aslam
Avoid landing page redirects
If you are getting "Avoid landing page redirects" warning in Google pagespeed, it will look like below .
To speed up page load times for visitors of your site, remove as many landing page redirections as possible, and make any required redirections cacheable if possible.
http://site.com/blog is a non-cacheable redirect to http://site.com/blog/.
What is a landing page redirect?
Landing page redirects are redirects that are made when the user loads a page (an index page like http://site.com/blog ).
These are the most wasteful redirects that are many web developers are unaware of.
Here is an example.
If you go to
http://example.com/directory
It will redirect you to
http://example.com/directory/
So, as you may have noticed already, it is because in our first URL, there is no trailing slash and server itself add a trailing slash if it returned a 301 redirect.
Typically if a user requests a resource without a trailing slash, which points to a directory,
mod_dir
redirects him to the same resource, but with trailing slash for some good reasons:- The user is finally requesting the canonical URL of the resource
mod_autoindex
works correctly. Since it doesn't emit the path in the link, it would point to the wrong path. DirectoryIndex
will be evaluated only for directories requested with trailing slash.- Relative URL references inside html pages will work correctly.
Comments
Post a Comment