0

A secured websites homepage consists of 50 https requests, totalling 400kb with a performance grade of 98 (Google PageSpeed) all from 1 host at the moment: https://www.foo.com/

My htacces makes all non-www to go to www and all http to go to https, so the dominans become all https://www.

RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.szzz.nl%{REQUEST_URI} [R=301,L,NE] 

Now, the only "limitation" to the speed is that the waterfall processes the 50 requests from the html in the same single que:

https://www.foo.com/....php
https://www.foo.com/....css
https://www.foo.com/....js
https://www.foo.com/....jpg

While I would like to parallelize and spread my static components in my html to four different subdomains for example:

https://www.foo.com/...php
https://sub1.foo.com/...css
https://sub2.foo.com/...js
https://sub3.foo.com/...jpg

My hoster enabled a subdomain wildcard for me, now any and all subdomains work https://anything.foo.com but these cost a redirect each while I would like to have the static contents loaded directly through https://[sub].foo.com without any redirects.

How to achieve this for my four subdomains to bypass the redirect and fetch the static concents as fast as possible using just htaccess? Thank you!

Related:
Maximum Parallel HTTP connections per browser using subdomains
Can browsers download 2 components in parallel per subdomain

Sam
  • 15,254
  • 25
  • 90
  • 145
  • How you tried enabling HTTP/2 for the single www/ domain? Domain sharding is an anti pattern in the HTTP/2 context and isn't required or desired. – Anand Bhat Jul 05 '17 at 17:48
  • @Anand Bhat: what do you mean by "domain sharding is an anti pattern" and can you explain precisely how HTTP/2 an be enabled on shared hosting that uses HTTP1.1? Thanks! – Sam Jul 05 '17 at 22:19
  • With HTTP/2, domain sharding, or splitting into multiple domains, becomes unnecessary as multiple requests are multiplexed into a single connection (https://www.stevesouders.com/blog/2013/09/05/domain-sharding-revisited/). Check with your hoster when they plan to enable HTTP/2, if you can increase your KeepAlive (from the current 2 seconds) and enable HSTS to avoid the redirect. As for your original question, all htaccess rules are evaluated at your server and the client cannot avoid the redirect. You will need to modify your actual html code to point resources to separate domains. – Anand Bhat Jul 06 '17 at 18:56
  • Thanks! I will ask my hoster that. I am willing to change html sorry wasnt clear on that! My ACTUAL question for now is and remains unanswered but thanks for the tips I will ask my hoster that indeed if they can run http2 then all this is obsolete/unneccessary. – Sam Jul 08 '17 at 17:44

0 Answers0