How to enable automatic redirect from HTTP to HTTPS

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/

Tags

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top