In the root of your website directory, create an .htaccess file. Note the “.”. This designates a hidden file in Linux.
The contents of this file must read:
RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Reference:
https://hetzner.co.za/help-centre/website/force-https-using-htaccess-file/