Base de conhecimento

1000 perguntas frequentes, 500 tutoriais e vídeos explicativos. Aqui, você encontra apenas soluções!

Force HTTPS (SSL) for the URL displayed by the web browser

Atualização 05/06/2026

This guide explains how to redirect all visitors to a secure HTTPS (SSL) version of a website hosted on Infomaniak's Web Hosting.

 

Introduction

  • This redirection is generally automatic with a standard configuration and installation.

 

Manual Redirection via .htaccess File

Prerequisites

  • You must have a valid and functional SSL certificate for the Infomaniak website.

Next, modify or add the following 3 lines to the .htaccess file of the website in question to ensure that all its visitors are automatically redirected to its secure HTTPS version:

RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://domain.xyz/$1 [R=301,L]

Replace domain.xyz with your domain name and the appropriate extension (.com, .fr, .ch, etc.).

If you encounter any issues, replace the second line of the code above with RewriteCond %{HTTP:X-Forwarded-Proto} !https.

 

With a CMS

Most web applications, such as WordPress and Joomla, have extensions/plugins that automatically redirect visitors to the secure HTTPS version of a website.

WordPress

If you are using a content management system (CMS) like WordPress to create your website, it is recommended to install an extension to perform this redirection:

  1. Back up the website's files and database as a precaution.
  2. Install the Really Simple SSL extension or a similar one from the WordPress console and activate it.
  3. Visitors are now automatically redirected to the https version of the site.

Joomla

Replace domain.xyz with your domain name and the appropriate extension (.com, .fr, .ch, etc.).

  1. Find the line

    var $live_site ='';

    in the Joomla configuration file (configuration.php) on the server.

  2. Replace it with

    var $live_site = 'https://www.domain.xyz';
  3. Add three lines to your .htaccess file on the server:

    RewriteEngine On
    RewriteCond %{HTTPS} OFF
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
  4. Open the Joomla administration panel in "System - Configuration".
  5. Click on the "Server" tab and, under "Force SSL", choose "Administration and site".
  6. Save, and visitors will now be automatically redirected to the https version of the site.

Prestashop

  1. Go to the general settings in the Prestashop back office to enable SSL:
    1. < v1.7 click on "Preferences" then on "General"
    2. > v1.7 click on "Shop Parameters" then on "General"
  2. Activate the "Enable SSL" toggle switch to "YES".
  3. Click on "Save".
  4. In the same place, activate the "Enable SSL on all pages" toggle switch to "YES".
  5. Click on "Save".

If a security padlock does not appear in the browser or a warning is displayed, the issue may be with the template or modules, as they are sometimes not fully compatible with SSL. Your Prestashop may then be loading elements (images, .css or .js files, fonts, etc.) in "http" when they should now be loaded in "https".

Drupal

Please refer to this article (in English) which explains how to switch a Drupal site from http to https.

 

Alternative solutions

Replace domain.xyz with your domain name and the appropriate extension (.com, .fr, .ch, etc.).

In your .htaccess file, to force the site URL to be https:// but without www:

RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www. [NC]
RewriteRule (.*) https://domain.xyz/$1 [R=301,L]

In the case of a redirection loop, adapt the code above as follows:

RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} !https [OR]
RewriteCond %{HTTP_HOST} ^www. [NC]
RewriteRule (.*) https://domain.xyz/$1 [R=301,L]

In your .htaccess file, to force the redirection with www:

with subdomains:

RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www. [NC]
RewriteRule (.*) https://www.domain.xyz/$1 [R=301,L]

In the case of a redirection loop, adapt the code above as follows:

RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} !https [OR]
RewriteCond %{HTTP_HOST} !^www. [NC]
RewriteRule (.*) https://www.domain.xyz/$1 [R=301,L]

and without subdomains:

RewriteEngine on
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^domain.xyz [NC]
RewriteRule (.*) https://www.domain.xyz/$1 [R=301,L]

In the case of a redirection loop, adapt the code above as follows:

RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} !https [OR]
RewriteCond %{HTTP_HOST} ^domain.xyz [NC]
RewriteRule (.*) https://www.domain.xyz/$1 [R=301,L]

 

Common errors after an https redirection

To resolve common issues that may occur after redirecting your website to its secure https version, please refer to this other guide.


Esta seção de perguntas frequentes foi útil?