Security with SSL certificate nowadays is a very important factor for trust. Whereas Google announced HTTPS as a ranking signal and primarily indexing https:// sites over HTTP link/pages.

Let’s get into How to do 301 redirect http to https htaccess cPanel? So you make your website SSL secured.  Also YOu can find video guide to easily redirect to https in htaccess.

As out .htaccess file is hidden from the user and without .htaccess file you cant migrate from HTTP to https. So, first, understand how to view the hidden files in the cPanel.

There are many website hosts and CDNs in the world, which offer free security certificates to encourage people to make the switch, but many people still aren’t moving, why?

Why Redirect HTTP to HTTPS using Htaccess?

Communication between the website and your browser are encrypted. HTTPS used to protect highly confidential online transactions like online banking and online shopping order forms. So its always better to redirect all http to https htaccess.

  • Data integrity and security, without any modification data, go to the intended user and with more confidential and secure.
  • Encryption play a very important role. Encrypting the exchanged data to keep it secure.
  • Authentication helps to prove that your users communicate with the intended website it builds trust which helps to increase business benefits.

SEO benefits of using HTTPS:

  • Increased rankings: If you use HTTPS then slight ranking boost up of your site.
  • Security and privacy.

For SEO goals and website, HTTPS adds some security

  1. It prevents your site by third parties.
  2. Provide more security for visitors.
  3. It makes encryption of all communication, including URLs, which protects things like browsing history and credit card numbers.

A standard cheap Linux reseller hosting India has a shield guard technology (HTTP/3 & QUIC). That allows encrypting the connection between the two intended data transfer websites.

Redirecting HTTP to HTTPS without WWW

You need .htaccess files to handle redirection to HTTP to https. If there is need to create .htaccess files you can use your control panel -> file manager.

To automatically redirect your page HTTP to https you need to add the following code in your .htaccess files

Code to redirect http to https without www

RewriteEngine On

RewriteCond %{HTTPS} off

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

via 301 htaccess redirect http to https without www

How 301 differ from 302

  • 301 = if you want permanent redirection (SEO benefits)
  • 302 = if you want the temporary redirection

 If there is already an existing .htaccess file:

  1. Avoid duplication of RewriteEngine On.
  2. Lines beginning from RewriteCond and RewriteRule should immediately follow the already-existing RewriteEngine On.

Pay attention to above points while you for HTTP to https redirect without www

Redirecting HTTP to HTTPS with WWW

Following code, you need to add in your .htaccess files to redirect page HTTP to HTTPS redirect htaccess code with www

Code to HTTP to HTTPS  redirect htaccess with www

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

how to redirect 301 permanently http to https www

 

How 301 differ from 302

  • 301 = if you want the permanent redirection
  • 302 = if you want the temporary redirection

 If there is already an existing .htaccess file:

  1. Don’t make a duplicate copy of RewriteEngine
  2. Lines beginning from RewriteCond and RewriteRule should immediately follow the already-existing RewriteEngine On.

 If you want to keep your website secure then you should use these codes to convert HTTP to HTTPS.

With an HTTPS connection, all communications are securely encrypted. If somebody tries to break the connection they would not be able to decrypt any of the data which passes between you and the website. So its always better to htaccess redirect HTTP to HTTPS.

If you have any doubts or any problems then please let us know we would like to solve your problems.

You can click here to read most important, How to avoid email spamming.