Force your site to redirect to HTTPS (SSL) using the .htaccess file | Dataplugs

Force your site to redirect to HTTPS (SSL) using the .htaccess file

To force visitors to your website through SSL (HTTPS) page by adding this code in your website’s .htaccess file

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Note: The .htaccess file needs to be located in your public_html directory. If your website is addon domain, then the .htaccess should be placed in the corresponding folder.

You can create or edit the .htaccess file either via FTP, or using with the File Manager in cPanel.

In case there is no .htaccess file, check if Show Hidden Files is enabled in the File Manager.