You can make every HTTP resource return an HTTP 301 redirect to the corresponding HTTPS resource. Browsers will follow these redirects and immediately load the secure site.
(Certbot offers to set up this kind of HTTP redirect for users when used with --apache or --nginx.)
In addition, if you’re confident of your ability to keep your site in HTTPS with a valid certificate permanently, you can set an HSTS header
to tell individual visitors’ browsers to only use HTTPS when communicating with your site.
The way of doing each of these things is entirely specific to your hosting environment. There’s no generic way to do this that works for all web sites. For example, it might involve editing your web server configuration files or selecting an option in a control panel or a web application configuration interface.
Edit: Apart from HSTS, browsers do use whatever protocol is specified in a link’s URL, so if you create links to your site, it does matter for the browser’s behavior whether they’re HTTP or HTTPS links. However, if your site returns a redirect from the HTTP resource to the HTTPS resource, users won’t necessarily notice this because the version of the page that actually loads at the end will be the HTTPS version. Despite that, it’s still good practice to use only HTTPS links because of the SSL Stripping attack.
Thanks schoen.
It’s very interesting, and worrying at the same time.
I read through the wiki page, and noted the HSTS limitations.
I’m going to research how to implement it, as it seems better to have it than not.
Once I have setup autoSSL-renew, that should be fine.
I didn’t note any downside as yet, from what I’ve read.
I was thinking about .htacess in my public_html directory.
Have I written that code correctly?
I could list every html page on the site.
Or perhaps there is a better way than using .htacess.
Regarding setting HSTS in cPanel - there is no option.
I’m on a godaddy hosted site, using Apache.
If you can post the line of code and tell me which directory to place it, then I will try it out.
Maybe also adding redirects for each page will provide belt and braces
I’m thinking of enabling ‘no indexing’ - default setting displays directory contents when no index.html is present.
Are there any downsides to ‘no indexing’?
The .htaccess applies to all requests, so requests to https://www.example.com/ are getting redirected to https://www.example.com/. The browser will follow that redirection repeatedly until reaching its redirection limit.
What application are you running ? many ( like wordpress ) have a default set in their config - which you need to change to https ( otherwise it could be redirecting to http … hence you have a loop )