How to redirect your website from HTTP to HTTPS through .htaccess file?

Most of the Search engine i.e google chrome & firefox start showing warnings on websites without secure socket layer SSL. If SSL certificate is installed on your website it will make secure to your visitors and make it more reliable to put any sensitive data, you can redirect your site from https to https through .htaccess file by following few simple steps.

.htaccess files is configuration files used to manage the configuration of the Apache Web Server.

This article describes how to redirect your website from HTTP to HTTPS through .htaccess file:




Login to your CPanel with your credentials





Go to the File manager section.






Go to setting section at the top right corner in order to show dot(.) files or hidden files.





Select the "Document Root” for your domain and check "Show Hidden Files" (dotfiles). And click on Save button.





Now find the .htaccess file, right click on .htaccess file and click edit from options.





You are in .htaccess file, paste the following code into the .htaccess file to redirect it to https.

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




Now click on save changes button in the top right corner to save your .htaccess file.


All Done! By following this simple criteria you can change your website to HTTPSWebSouls provides SSL Certificate in Pakistan that will secure your information with 256 bit encryption. Connect with us and we understand your all web hosting needs better than others.


Team Technical



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

Related Articles

..htaccess guidance

  .htaccess guidance .htaccess is a special Apache file that tells your website how to...

Linux Sites preview Offline

Linux Site's Preview Offline   http://IP_address/~UserName OR http://ServerName/~userName...

How to scan your website's data from CPanel?

1. Open your Cpanel account. 2. Then go to the category “Advanced” 3. Then click on “Virus...

How can I download a backup of my site?

Please login to your control panel and create a full backup. This may take a few minutes to...

How to create an addon domain?

An add-on domain is a fully functional domain and it can be created by using your Cpanel. Add-on...

Powered by WHMCompleteSolution