Redirect all website traffic from http to https with the htaccess file

This knowledge base article applies to cPanel hosting only, use the link below for DirectAdmin

Follow the steps below to redirect all requests on your website from port 80 / http to port 443 / https
Download your .htaccess file from the public_html directory or use the file manager within cpanel to edit the .htaccess file

With the .htaccess file open and ready for editing, change the following

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

to 

<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*) https://%{SERVER_NAME}/$1 [R,L]
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Save the file and upload to the server, or in the case of using the file manager - click save and close



  • https, redirect, htaccess, ssl, http, http redirect
  • 1 Users Found This Useful
Was this answer helpful?