Home Guides Glossary

Redirect HTTP to HTTPS Automatically

If you have a secure certificate (SSL) on your website, you can automatically redirect visitors to the secured (HTTPS) version of your website to make sure their information is protected.

How you redirect traffic depends on the type of hosting you have.

Linux & cPanel

Linux-based accounts use .htaccess files to handle redirection.

If you need to create a .htaccess file, you can use your control panel's file manager (Web & Classic / cPanel).

Using the following code in your .htaccess file automatically redirects visitors to the HTTPS version of your Website:

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.

Windows & Plesk

Windows-based accounts use web.config files to handle redirection.

If you need to create a web.config file, you can use your control panel's file manager (Web & Classic / Plesk).

Using the following code in your web.config file automatically redirects visitors to the HTTPS version of your Website:

<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

If you have an existing web.config file:

  • Ensure you have sections (i.e. opening and closing tags) for:
    • system.webServer (which contains rewrite)
    • rewrite (which contains rules)
    • rules (which contains one or more rule sections)
    Insert any of those sections that do not exist.
  • Insert the entire rule section, including match, conditions, and action, inside the rules section.

    You're inserting the rule (without an 's') inside the rules (with an 's') section.

Domain Registration

Pay less for website domain names. Register your own .com, .net or .org for as low as $10.18 per year. We have everything you need to get online with your new domain.

Website Builder

Build an amazing website in just under an hour with Website Builder. Take advantage of designs created just for your industry and then customize them to reflect your one-of-a-kind idea.

Website Security

Protect your website and keep customers safe. Your comprehensive Website Security solution. Get peace of mind by securing your websites.

cPanel Hosting

Everything needed to give your website the high-performance home it deserves.  Protect transactions and secure your customer's data with a SSL Certificate
Copyright © 2005 - 2024.  All rights reserved.  Privacy Policy