How to Force Redirect Http to Https by Editing .htaccess File?

Nov 6, 2019

How to Force Redirect Http to Https by Editing .htaccess File?

To perform htaccess redirect to HTTPS, you need to Install SSL certificate. After successful installation of SSL, the first step involves editing of .htaccess file. You can do it via FTP or cPanel File Manager. The second step involves htaccess redirect to https in Apache or NGINX.

Insert this code to the .htaccess file and force all web traffic to use HTTPS. 


RewriteEngine On 
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ //www.yourdomain.com/$1 [R,L]

Note: if you can't find .htaccess file in the Public_html File, Create a FIle & Insert above code.