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:
- Log in to your cPanel account.
- Go to the Domains section and select Redirects.
- Choose Permanent (301) from the redirect type dropdown.
This sets a permanent redirection, which is preferred for SEO and user experience.
- Select your domain from the list.
- Leave the path field empty.
This applies the redirect to the entire domain.
- In the Redirects to field, enter the secure URL, starting with https://.
- Click Add to apply the redirect.
- 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.
Mohd Shakir Zakaria is an experienced cloud architect with a strong development and open-source advocacy background. He boasts multiple certifications in AWS, Red Hat, VMware, ITIL, and Linux, underscoring his expertise in cloud architecture and system administration.
Comment anonymously. Login not required.