I created a Joomla website and published online in the customer hosting space of the provider Aruba. Aruba, in his hosting plans, provides a free domain validated certificate and so I wanted to use it. I installed the certificate and then I tried to make an automatic redirect in order to use the HTTPS protocol.

Around the web I found several articles on how to do it using the Apache .htaccess file, but none of them worked correctly for me. I often got the message “Bad request – too many redirects”.

I finally found the solution in an offical Aruba guide, that you can find at this address:

https://guide.hosting.aruba.it/servizi-aggiuntivi/certificato-ssl/ssl-per-servizi-hosting/ridirigere-traffico-da-http-a-https.aspx

Basically, to redirect all the traffic to HTTPS you have to configure your .htaccess file with these directives:

RewriteEngine On

RewriteBase /
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Using the directives above, the site now correctly redirect to HTTPS.

Bye bye 🙂