I added an SSL certificate with Lets Encrypt / Certbot on my Debian 9 (Stretch) host.
To change my Apache configuration, certbot essentially copies the vhost.conf file, encloses it, and inserts the Include, SSLCertificateFile, and SSLCertificateKeyFile entries.
The old HTTP file, vhost.conf, has been modified to be easily redirected to HTTP over HTTPS using Rewrite rules.
I'm glad that the site is HTTPS for all end users, but I might want a PHP script to be able to request something from localhost over HTTP and force those requests to use HTTPS when the traffic is complete Local seems unnecessary.
For the purposes of this question, I reset the old HTTP vhost.conf file to handle HTTP traffic as before.
So my question is if this works correctly in my HTTP vhost file.
Redirect permanent "/" "https://mydomain.ltd/"
It certainly is from my tests appear However, I am concerned that SSL is new to me, and while it is generally straightforward, there is great potential for out-of-the-box situations where things may not work as intended.
I like my suggested solution like that should Redirect all users with a modern browser to use HTTPS without completely blocking HTTP access. I also prefer to use
Redirect permanent Override rules as this is easier and probably more efficient. But again, the fact that a fairly high percentage of Internet advices suggest using the method of rewriting is somewhat disconcerting!