<IfModule mod_rewrite>
#set the default action for all other requests
<LocationMatch "^/(?!\.well-known)">
#send all other requests to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{SERVER_NAME}/$1 [L,R=301]
</LocationMatch>
</IfModule>
OR
<IfModule mod_rewrite>
#set the default action for all other requests
<LocationMatch "^/(?!\.well-known)">
#send all other requests to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule / https://%{SERVER_NAME}%{REQUEST_URI} [L,R=301]
</LocationMatch>
</IfModule>
I donāt know how much you have put into this system, nor how much time/effort you are willing to āwasteā.
No knowing anymore than I can assume, I would replace apache with nginx and go from there.
You could even have both installed.
[just NOT running on the same IP and port]
Example:
Apache could be moved to 81 & 444
nginx could then use 80 & 443