Force HTTPS on your website Print

  • 0

Try placing the following code up the top of your .htaccess file that resides in the root directory of your website:

# Force redirect to HTTPS
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

# Upgrade non-secure elements to HTTPS
<ifModule mod_headers.c>
Header always set Content-Security-Policy "upgrade-insecure-requests;"
</IfModule>

You can edit your .htaccess file via an FTP program such as FileZilla or through the File Manager in cPanel.


Was this answer helpful?

« Back