Redirecting HTTP to Non-HTTP using a .htaccess file


The below can be added to a .htaccess file in order to redirect a website from HTTP, to HTTPS. It should generally be added before other rules.

Place the .htaccess file inside the public_html folder of the site you want to redirect to HTTPS.

It is possible to do this using the File Manager in cPanel. Copy and paste the below code into the new .htaccess file you have just created.

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
Have more questions? Submit a request