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 gives you some indications to help you redirect all visitors to your site to its secure https version (SSL). In the event of standard configuration and installation, it is in principle automatic, but after reading this guide and if necessary, you can contact one of our partners as our support service cannot assist you in this matter.
Requirements
A valid an functional SSL certificate SSL for your website.
Manual redirection with a .htaccess file
Simply modify or add the following 3 lines to the .htaccess file of the desired website so that all visitors automatically access the secure https version:
RewriteEngine on
RewriteCond %{HTTPS} off
RewriteRule (.*) https://your-domain.com/$1 [R=301,L]
- Replace your-domain.com with your domain name with the appropriate extension (.com, .fr, .ch, etc.)
- Replace the second line of the code above with RewriteCond %{HTTP:X-Forwarded-Proto} !https in the event of problem
And with WordPress ?
If you use a content management system (CMS) such as WordPress or Joomla to create your website, we advise you to install and extension to implement this redirection. Most web applications Web such as WordPress and Joomla have extensions/plugins which automatically redirect visitors to a site to its secure https version.
- Back up the files and database of the site as a precaution
- Install the Really Simple SSL extension via the WordPress console and enable it
- Visitors are now automatically redirected to the https version of the site
- In the event of problems (continuing after the cache has been deleted, 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 with var $live_site = 'https://www.votre-domaine.ici';
- add three lines in your .htaccess filer 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 select "Administration and site" under “Force SSL"
- 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 the SSL:
- < v1.7 click on "Preferences" then on "General"
- > v1.7 click on "Store settings" 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 if a warning is displayed, look at the templates or modules, as these are not always entirely compatible with the SSL. Your Prestashop then loads elements (images, .css or .js files, fonts, etc.) in "http" whereas these should now be loaded in "https".
For Drupal:
This article (in English) explains how to change a Drupal site from http to https.
Alternative solutions:
In your .htaccess file, to force the website URL to be https:// but without www :
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www. [NC]
RewriteRule (.*) https://domaine.com/$1 [R=301,L]
In the case of a redirection loop, adapt the above code by:
RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} !https [OR]
RewriteCond %{HTTP_HOST} ^www. [NC]
RewriteRule (.*) https://domaine.com/$1 [R=301,L]
In your .htaccess file, to forcer the redirection with www
with the sub-domains:
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www. [NC]
RewriteRule (.*) https://www.domaine.com/$1 [R=301,L]
In the case of a redirection loop, adapt the code above by:
RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} !https [OR]
RewriteCond %{HTTP_HOST} !^www. [NC]
RewriteRule (.*) https://www.domaine.com/$1 [R=301,L]
and without the sub-domains:
RewriteEngine on
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^domaine.com [NC]
RewriteRule (.*) https://www.domaine.com/$1 [R=301,L]
In the case of a redirection loop, adapt the code above by:
RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} !https [OR]
RewriteCond %{HTTP_HOST} ^domaine.com [NC]
RewriteRule (.*) https://www.domaine.com/$1 [R=301,L]
Common errors following a redirection https
To resolve the common problems which may occur following a redirection of your website to its secure https version, please consult this guide.