Skip to main content

How we Redirect website from HTTP to HTTPS in Lunux VPS/DS

Login to cPanel

Once logged into cPanel, click on the “File Manager” located in the Files section of cPanel.

It will open a new tab in your browser and once you are in File Manager, you will see a dashboard like below.
Make sure that Show Hidden Files (dotfiles) is checked, and click Save

Find the .htaccess file in root directory like public_html. If your website is in a subfolder, then the .htaccess should be placed in the corresponding subfolder.

Right-click on the .htaccess file and click on “Code Edit” on the menu.

A dialogue box may pop up asking about encoding. Click the “Edit” button to continue.

add following these rules in your website’s .htaccess file to redirect your domain or website HTTP to HTTPS:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

“Save Changes” when done.

Test your website to make sure it is loading without any error. In case, there is an error, restore to the previous version and try again.

Once you are done, click “Close” to close the window.

Leave a Reply