Should I remove HTTP to HTTPS redirects to fix performance problems reported by Google Pagespeed Insights?
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]
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 thehttpsandwww. Users should never need the redirects once they are on the site. - Some other sites may be linking to you with
httpor withoutwww. If you stop servinghttpthose links would break. - Type-in traffic typically hits
httpbefore getting redirected tohttps. Users that type in "example.com" typically don't go straight tohttps. A few browsers can now be configured to tryhttpsfirst, 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 forhttpandhttps, there is no site-specific way to turn off just one of them. You could configure your site to serve an error forhttp, but you wouldn't be able to stop the webserver from responding tohttprequests.
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.
Comments
Post a Comment