Error: HTTP redirects to www first
http://example (HTTP) should immediately redirect to https://example (HTTPS) before adding the www subdomain. Right now, the first redirect is to https://www.example. The extra redirect is required to ensure that any browser which supports HSTS will record the HSTS entry for the top level domain, not just the subdomain.
As far as I can understand, the redirect, to be valid, should be done this way:
- http://example (this is what the user enters in the address bar)
- https://example (first redirect, to HTTPS)
- https://www.example (second redirect, to subdomain www)
At the moment, this is my htaccess
code causing the redirect (the htaccess is the ONLY thing I can edit because I'm in a very restrictive shared hosting environment):
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]
Is it possible to insert another redirect here? Is it advisable? How could I do?
Thanks anybody