I'm trying to set HSTS up correctly on my website and it is currently "half-working", I need to find the correct way to redirect: http://www.example.com
to https://www.example.com
finally to https://example.com
.
Actually, the website has 1 redirect per URL version:
http://www.example.com
301 redirect tohttps://example.com/
http://example.com
301 redirect tohttps://example.com/
https://www.example.com
301 redirect tohttps://example.com/
I now need to adjust the redirection through my .htaccess
making it result this way:
http://www.example.com
301 redirecthttps://www.example.com
301 redirecthttps://example.com
"
I tried a couple of times, but I always end up shutting the website down. Could you please help me to fix this?
Sorry guys, I forgot to mention something important: I have already installed HSTS and it is working on example.com
but when i test it as www.example.com
i get "Error: Subdomain , Error: No HSTS header , Error: HTTP does not redirect to HTTPS"
I'm testing it with hstspreload.org
http://www.example.com
(HTTP) redirects tohttps://example.com/
. The first redirect fromhttp://example.com
should be to a secure page on the same host (https://www.example.com
).