Overview
Want to ensure your website visitors have a secure connection? This guide will show you how to easily redirect HTTP traffic to HTTPS in cPanel, as long as you have an SSL certificate installed. We'll walk you through the built-in tool that automates this process, making your website a more secure space for everyone.
Enforcing SSL for the main domain
- Log in to your cPanel account.
- From the Domains menu, click Domains
- This will open a page where you can toggle the HTTPS redirect on or off.
- Ensure that you have installed SSL and the option to Run appears.
- Your domain name is now running with an SSL certificate.
Note:
To ensure a secure connection, leaving HTTPS enabled is highly recommended. However, if the option to enable HTTPS is missing, it's because this domain currently lacks an SSL certificate. Installing an SSL certificate is the first step, and once complete, the HTTPS option will be available for you to activate.
Routes users to the secure version (HTTPS) of your site
Linux utilizes .htaccess files to manage redirection. You might need to create a .htaccess file, which can be done through your control panel's File Manager. By placing the following code in your .htaccess file, visitors will be automatically redirected to the HTTPS version of your site:
RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
If you have an existing .htaccess file:
- Do not duplicate RewriteEngine On.
- Make sure the lines beginning RewriteCond and RewriteRule immediately follow the already-existing RewriteEngine On.