1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Enforce HTTPS (SSL) for the URL displayed by the web browser
This guide explains how to redirect all visitors to a secure HTTPS version of a website hosted on Infomaniak Web Hosting.
This redirection is usually automatic with standard configuration and installation ⚠️ For additional help contact a partner or fill out a tender — also read the role of the host.
Prerequisites
- Have a valid and functional SSL certificate for the Infomaniak website
Manual Redirection using .htaccess file
Simply modify or add the following 3 lines to the .htaccess file of the concerned website so that all its visitors automatically access its secure HTTPS version:
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://domain.xyz/$1 [R=301,L]
- Replace the second line of the above code with RewriteCond %{HTTP:X-Forwarded-Proto} !https in case of any issues
With a CMS
Most web applications like WordPress and Joomla have extensions/plugins that automatically redirect visitors from a site to its secure HTTPS version.
WordPress
If you're using a Content Management System (CMS) like WordPress to build your site, we recommend installing an extension to perform this redirection:
- Backup the site files and database as a precaution
- Install the Really Simple SSL or similar extension from the WordPress console and activate it
- Visitors will now be automatically redirected to the HTTPS version of the site
- In case of confirmed issues (persistent after clearing cache, etc.), you can also use Velvet Blues update URLs
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 under "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
Prestashop
- Access 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 on "Save"
- In the same place, switch the "Enable SSL on the entire site" button to "YES"
- Click on "Save"
If a security padlock does not appear in the browser or a warning is displayed, check the template or modules as sometimes they may not be fully compatible with SSL. Your Prestashop might then load elements (images, .css or .js files, fonts...) via "http" instead of "https" which should now be loaded.
Drupal
This article explains how to move a Drupal site from http to https.
Alternative Solutions
Replace domain.xyz with your domain name including 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 case of a redirection loop, adjust 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 case of a redirection loop, adjust 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 case of a redirection loop, adjust 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 website to its secure HTTPS version, refer to this guide (click here).