How to make your website always open with the secure https:// address and in one form – with or without www.

A website can open at four addresses: with http:// or https:// and with or without www. It is better if visitors and search engines always end up at one secure https:// address – with or without www (choose one).

Log in to cPanel – see the article “1.2. Logging in to cPanel”.

1Turn on the HTTPS redirect

In the “Domains” section of cPanel, open “Domains”. In the “Force HTTPS Redirect” column, turn on the switch next to the domain (“On”). All visitors will then be redirected from http:// to https://.

You can turn the switch on once the domain already has an SSL certificate.

Turn on the HTTPS redirect

www or non-www (.htaccess)

If you want the website to always open without www or always with www, add the code at the beginning of the .htaccess file in the website folder (File Manager, for the main domain – the public_html folder; turn on “Show Hidden Files” in the settings). Replace jusudomens.lv with your domain. Save a copy of the file before making changes.

From www to non-www

RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.jusudomens\.lv$ [NC]
RewriteRule ^(.*)$ https://jusudomens.lv/$1 [L,R=301]

From non-www to www

RewriteEngine On
RewriteCond %{HTTP_HOST} ^jusudomens\.lv$ [NC]
RewriteRule ^(.*)$ https://www.jusudomens.lv/$1 [L,R=301]

  • Use only one of the options, otherwise you will create an endless redirect loop.
  • On a WordPress website, the www choice also depends on the address in the settings (“Settings” → “General”). It must match the option you have chosen.
  • More about HTTPS: see the article “4.7. How to make sure your website always opens with the secure https:// address”.

If you run into any difficulties, just write to us and we will help. support@area.lv

Was this answer helpful? 15 Users Found This Useful (26 Votes)