Should I remove HTTP to HTTPS redirects to fix performance problems reported by Google Pagespeed Insights?

Should I remove HTTP to HTTPS redirects to fix performance problems reported by Google Pagespeed Insights? - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the Should I remove HTTP to HTTPS redirects to fix performance problems reported by Google Pagespeed Insights? error on your web browser. Problem :


I have created a brand new website in which I publish various computing services I suggest to potential customers.


As far as I know, no other website on the World Wide Web links to that website and today in nearly mid 2021 when people create backinks, they normally just make them "example.com" (no http:// or https:// and no www.).


After testing the website in Google Pagespeed Insights I got only one error about slow loading times due to the specific reason of four redirects:


http://example.com | 630 ms
https://example.com | 480 ms
http://www.example.com | 630 ms
https://www.example.com | 480 ms

While I need the www. for a CDN to protect from possible DDoS attacks and using HTTPS as a web standard, principally I would never create non HTTPS backlinks to my website and don't worry from anyone on the planet doing that.


Given the current HTTPS culture and my site being currently backlinkless, should I remove HTTP to HTTPS redirects to fix performance problems reported by Google Pagespeed Insights?


Update --- current .htaccess redirection directives


RewriteEngine On
RewriteCond %HTTP_HOST !^www.
RewriteRule ^(.*)$ http://www.%HTTP_HOST/$1 [R=301,L]

Solution :

You should not remove HTTP to HTTPS redirects.



  • Removing them won't fix performance problems. Redirects only make it slower when users encounter them and most users should never see the redirects. Once a user is on your site (https://www.example.com/), all the links should keep the https and www. Users should never need the redirects once they are on the site.

  • Some other sites may be linking to you with http or without www. If you stop serving http those links would break.

  • Type-in traffic typically hits http before getting redirected to https. Users that type in "example.com" typically don't go straight to https. A few browsers can now be configured to try https first, but it isn't the norm yet.

  • If you are on shared hosting, you don't have the ability to turn off http. Shared hosting web servers are configured for http and https, there is no site-specific way to turn off just one of them. You could configure your site to serve an error for http, but you wouldn't be able to stop the webserver from responding to http requests.


The best thing to do is remove redirect chains. Your .htaccess rule currently has non-www traffic redirecting to http with the www. You should change it to redirect to https:


RewriteEngine On
RewriteCond %HTTP_HOST !^www.
RewriteRule ^(.*)$ https://www.%HTTP_HOST/$1 [R=301,L]

It is usually desirable to also redirect http to https in the same rule:


RewriteEngine On
RewriteCond %HTTPS off [OR]
RewriteCond %HTTP_HOST !^www.example.com$ [NC]
RewriteRule (.*) https://www.example.com/$1 [L,R=301]

You'd have to edit your site in place of example.com when using the rule.


We hope that this article has helped you resolve the redirects, https, performance error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

How to redirect to any domain [duplicate]

"302 found" for index page bad for SEO?

Create redirect from url like www.example.us/?p=100&option=