Back to home

How do I redirect from http:// to https://?

The redirection from http:// to https:// can be done with a .htaccess file. This file will be placed in the folder where the redirection should happen.

The code is as follows:

RewriteEngine on
RewriteCond %{HTTPS} !on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L,QSA]

Redirection through our SSL proxy

If you use our SSL proxy for your certificate, it terminates the SSL connection and connects in the background without a secure connection. The check above does not work and results in a redirection loop. But there is an alternate check which is based on a HTTP header:

RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L,QSA]

Didn't find what you were looking for?

Contact our support:

+41 44 637 40 40 Support Portal support@nine.ch