apache2 – Apache redirects HTTP to HTTPS without avoiding HTTP

Background

I have added an SSL certificate using Lets Encrypt / Certbot on my Debian 9 (Stretch) host.

To modify my Apache configuration, certbot essentially copies the vhost.conf file, wraps it and inserts the Include, SSLCertificateFile and SSLCertificateKeyFile entries.

And the old HTTP file vhost.conf is modified to simply redirect to HTTP to HTTPS using the rewrite rules.

I am happy that the site is HTTPS for all end users, but there may be circumstances in which I would like a PHP script to request some localhost over HTTP, and force those requests to use HTTPS when the traffic is completely The local seems unnecessary.

For the purpose of this question, I have reverted the old HTTP file vhost.conf to serve HTTP traffic as before.

Question

So my question is, if I put this in my HTTP vhost file, will it work correctly?


    Redirect permanent "/" "https://mydomain.ltd/"

From my test, certainly appears to work 100% correctly, but my concern is that I am new to SSL and, although it is quite simple, there is great potential for extreme cases in which things might not work as planned.

Additional Wittering

I like my proposed solution since should redirect all users with a modern browser to use HTTPS without completely preventing HTTP access. I also prefer to use Redirect permanent about rewriting the rules, since it is simpler and presumably more efficient. But, once again, the fact that a large proportion of Internet advice suggests using the rewrite method is a bit worrying.