Redirecting from HTTP to HTTPS is important for securing a website. HTTPS provides encryption for data transferred between the server and clients, which protects sensitive information such as login credentials and payment details. Setting up this redirection ensures that all visitors access the secure version of your site automatically.

Most modern websites are expected to use HTTPS, and search engines also prioritize secure sites. If your site is available on both HTTP and HTTPS, it can lead to SEO and user trust issues. A permanent redirect ensures all traffic goes through HTTPS, improving security and consistency.

In cPanel, configuring the redirection from HTTP to HTTPS can be done through the Redirects interface or by modifying the .htaccess file directly. Both methods ensure that all requests to the HTTP version are sent to the secure HTTPS version.

Steps to redirect HTTP to HTTPS in cPanel:

  1. Log in to your cPanel account.
  2. Go to the Domains section and select Redirects.
  3. Choose Permanent (301) from the redirect type dropdown.

    This sets a permanent redirection, which is preferred for SEO and user experience.

  4. Select your domain from the list.
  5. Leave the path field empty.

    This applies the redirect to the entire domain.

  6. In the Redirects to field, enter the secure URL, starting with https://.
  7. Click Add to apply the redirect.
  8. To verify, check the .htaccess file in the public_html directory.

    Sample .htaccess content for HTTP to HTTPS redirection:

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

    You may need to enable Show Hidden Files (dotfiles) in File Manager to see .htaccess.

Discuss the article:

Comment anonymously. Login not required.