1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Force the httpS (SSL) of the URL displayed by the web browser
This guide explains how redirect to a secure https (SSL) version all visitors of a site on Web hosting Infomaniak.
Preamble
- This redirection is normally automatic with a standard configuration and installation.
- For additional assistance contact a partner or launch a call for tenders free of charge — discover also the role of the host.
Manual redirection by .htaccess file
Prerequisites
- Have a valid and functional SSL certificate for the Infomaniak website.
Then change or add the next 3 lines to the file .htaccess
the website concerned so that all its visitors can automatically access its secure https version:
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://domain.xyz/$1 [R=301,L]
domain.xyz
by your domain name with the appropriate extension (.com, .fr, .ch, etc.).Replace the second line of the above code by RewriteCond %{HTTP:X-Forwarded-Proto} !https
in case of a problem.
With 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 use a content management system (CMS) like WordPress to realize your site, we advise you to install an extension to do this redirection:
- Save the files and database of the site as a precaution.
- Install the extension Really Simple SSL or similar from the console WordPress and activate it.
- Visitors are now automatically redirected to the version https of the site.
Joomla
domain.xyz
by your domain name with the appropriate extension (.com, .fr, .ch, etc.)Find the line
var $live_site ='';
in the Joomla configuration file (
configuration.php
) on the server.Replace by
var $live_site = 'https://www.domain.xyz';
Add three lines to your file
.htaccess
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 tab "Server" and under "Forcing SSL" choose "Administration and site".
- Save and visitors will now be automatically redirected to the version https of the site.
Prestashop
- Access the General parameters in Prestashop's back office, to enable SSL:
- < v1.7 click on "Preferences" then on "General"
- > v1.7 click on "Shop Settings" then on "General"
- Activate the toggle switch button "Activate SSL" on "YES"
- Click on "Save"
- At the same location, activate the toggle switch "Activate SSL on the whole site" on "YES".
- Click on "Save".
In the event that a security lock does not appear in the browser or a warning is displayed, you should look at the template or modules side because sometimes they are not fully SSL compatible. Your Prestashop will then load elements (images, .css or .js files, fonts, etc.) into "http" while these should now be loaded into "https".
Drupal
Be aware of this Article (in English) which explains how to pass a Drupal site from https.
Alternatives
domain.xyz
by your domain name with the appropriate extension (.com, .fr, .ch, etc.)In your file .htaccess
, to force the URL of the site 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 redirect loop, adjust the above code by:
RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} !https [OR]
RewriteCond %{HTTP_HOST} ^www. [NC]
RewriteRule (.*) https://domain.xyz/$1 [R=301,L]
In your file .htaccess
, 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 redirect loop, adjust the above code by:
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 sub-domains:
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 redirect loop, adjust the above code by:
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 due to https redirection
To solve common problems that may arise following a redirection of your website on its secure https version, read this other guide.