Limited offer: Get 50% OFF on monthly VPS Hosting plans!

How to Redirect HTTP Requests to HTTPS

Estimated reading time: 1 min

Once you have purchased and installed an SSL Certificate, you can automatically redirect visitors to the secure version of your website.

This ensures data sent to and from your website is securely encrypted. Besides this, according to Google – HTTPS is now a ranking signal among some other factors.

How to Redirect HTTP Requests to HTTPS

You can use the following code in your .htaccess file to make sure that happens.

1) Edit/Create a .htaccess file in the folder your site is being served from (normally public_html). You can easily edit the .htaccess file using an FTP client or through the online File Manager in cPanel.

2) Add the following code to the .htaccess file:

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

3) Save the file and check the results in your web browser by trying to access your site using standard HTTP rather than HTTPS.

If it is working correctly, you should be automatically redirected to https.

Please Note: If you do not have an SSL certificate installed, this could cause errors. Please make sure that you have an SSL certificate installed and properly working before attempting this.

If anything goes wrong for any reason, please don’t hesitate to contact our Support team by opening a ticket in your Lab.

Was this article helpful?
No 1