How to Redirect HTTP to HTTPS automatically

How to Redirect HTTP to HTTPS automatically

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 is Linux-based. Linux use .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 and RewriteRule immediately follow the already existing RewriteEngine On.

This will automatically redirect your bare domain to the secure HTTPS version.

Note: Custom site code can cause issues with the above method, which can be out of our scope of support.

  • How to Redirect HTTP to HTTPS automatically, Redirect HTTP to HTTPS, HTTP to HTTPS
  • 374 Users Found This Useful
Was this answer helpful?

Related Articles

 How to Increase PHP memory limit in WHM

Go to Service Configuration >> PHP Configuration Editor Change the value 32m to 64m or...

 How to Park a Domain in cPanel?

 How do I access my webmail?

Webmail can be accessed from one of the following URLs: http://webmail.yourdomain.com...

 How do I add a user to a MySQL database?

Login to cPanel. Locate and click on the "MySQL Databases" icon under the "Databases"...

 How do I backup my cPanel account?

Login to cPanel. Locate and click on the "Backup Wizard" icon within the "Files" category....