Skip to content
Sign In Create account

Your website

Redirect every visitor to HTTPS

Send http:// visitors to the secure address — with .htaccess on Linux or web.config on Windows.

2 min read Updated

Once your site has a certificate, send everyone who types http:// to https://. It protects every page, and search engines see one address instead of two.

Before you start

Check the site already opens on https:// without a warning. It works on the name the certificate was issued for — yourdomain.com, www.yourdomain.com or a subdomain. Redirecting to any other name shows visitors a certificate error.

Linux hosting (cPanel): .htaccess

Our Linux servers have Apache's mod_rewrite enabled. In your website folder (public_html), create a file called .htaccess — or edit the existing one — and add these lines at the top:

apache
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://yourdomain.com%{REQUEST_URI} [R=301,L]

Replace yourdomain.com with the exact name on your certificate.

Note

Files starting with a dot are hidden by default. In cPanel's File Manager, open Settings and tick Show Hidden Files.

Windows hosting (Plesk): web.config

Our Windows servers include the IIS URL Rewrite module. In your website folder (httpdocs), create web.config — or carefully edit the existing one — with:

xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Redirect to HTTPS" stopProcessing="true">
          <match url="(.*)" />
          <conditions>
            <add input="{HTTPS}" pattern="^OFF$" />
          </conditions>
          <action type="Redirect" url="https://yourdomain.com/{R:1}" redirectType="Permanent" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

If a web.config already exists, add only the <rule> block inside its existing <rules>.

Tip

WordPress? Set both addresses under Settings → General to https:// as well, or the site keeps linking to itself over HTTP.

Still stuck?

Open a ticket from your control panel and say which step you reached. A screenshot of what you see is the fastest way to show us.

Still stuck

Nothing here fits? Write to us.

Tell us what you are trying to do rather than what went wrong, and we will tell you whether it is something we can fix from here.

  • Answered by a person

    There is no ticket robot in front of us. What you write is what somebody reads.

  • Say what you are trying to do

    The fastest answers come from the message that explains the goal, not only the error.

  • Your services are already in front of us

    Sign in first and we can see the account the question is about without asking you to describe it.