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.
This sets a permanent redirection, which is preferred for SEO and user experience.
This applies the redirect to the entire domain.
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.