1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Force httpS (SSL) in the URL displayed in the browser address bar
This guide helps you redirect all visitors to your website to its secure https (SSL) version on Infomaniak Web Hosting.
Prerequisites
Having a valid and functional SSL certificate on your site.
Manual Redirection with an .htaccess File
Simply modify or add the following 3 lines to the .htaccess file of the desired site so that all its visitors are automatically directed to its secure https version:
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://domain.xyz/$1 [R=301,L]
- Replace the second line of the code above with RewriteCond %{HTTP:X-Forwarded-Proto} !https in case of any issues.
With WordPress
If you use a content management system (CMS) like WordPress or Joomla to build your site, we recommend installing an extension to handle this redirection. Most web applications like WordPress and Joomla have plugins that automatically redirect site visitors to their secure https version.
- Backup the site files and database as a precaution.
- Install the Really Simple SSL plugin from the WordPress dashboard and activate it.
- Visitors will now be automatically redirected to the https version of the site.
- In case of persistent issues (after clearing the cache, etc.), you can also use Velvet Blues Update URLs.
For Joomla:
- Find the line var $live_site =''; in the Joomla configuration file (configuration.php) on the server.
- Replace it with var $live_site = 'https://www.domain.xyz';
- Add three lines to your .htaccess file on the server:
RewriteEngine On
RewriteCond %{HTTPS} OFF
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} - Open the Joomla administration panel in "System - Configuration".
- Click on the "Server" tab and under "Force SSL", choose "Administration and site".
- Save, and visitors will now be automatically redirected to the https version of the site.
For PrestaShop:
- Access the General Settings in the PrestaShop back office to enable SSL:
- < v1.7 click on "Preferences" then "General".
- > v1.7 click on "Shop Parameters" then "General".
- Switch the "Enable SSL" button to "YES".
- Click "Save".
- In the same location, switch the "Enable SSL on the entire site" button to "YES".
- Click "Save".
If a security padlock does not appear in the browser or if a warning is displayed, look into the template or modules, as they may not be perfectly compatible with SSL. Your PrestaShop may still load elements (images, .css or .js files, fonts, etc.) as "http" when they should be loaded as "https".
For Drupal:
This article 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 above code to:
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 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 above code to:
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 above code to:
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 https Redirection
To resolve common issues that may occur after redirecting your site to its secure https version, refer to this guide (click here).