Redirect HTTP to HTTPS automatically
Last Updated: January 20, 2022
If you have a secure socket layer certificate (SSL) on your website, you can automatically redirect visitors to the secured (HTTPS) version of your site for a secure connection. Name.com hosting uses cPanel and there is a simple tool in cPanel that will help you accomplish this.
Enforcing SSL for main domain / Startup Hosting:
- Log into your cPanel
- In the Domains section, click the Domains icon.
- This will open a page where you can toggle the HTTPS redirect on or off. We recommend leaving it on. If there is no option to enable HTTPS, it's because that domain does not have SSL installed. First make sure SSL is installed and the option will present itself.
Your domain should now be using HTTPS.
Enforcing SSL for Addon domains:
Linux uses .htaccess
files to handle redirection.
You may need to create a .htaccess
file, and you can use your control panel's File Manager.
Using the following code in your .htaccess
file automatically redirects visitors 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
andRewriteRule
immediately follow the already existingRewriteEngine On
.