force ssl conf file apache2 code example
Example 1: apache redirect http to https
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
Example 2: redirect http to https apache2 ubuntu 20.04
HTTP Redirection