Automatically redirect to SSL / https website

Automatic SSL redirect

If you want to redirect visitors entering your domain name example.com automatically to https://example.com, please create a textfile on your PC called .htaccess (the leading dot is important!).

Put the following contents in that file, save it and upload it to your web root folder.

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
.htaccess content

Please note:

The above requires that you have activated SSL for your webhost:

https://faq.moniker.com/homepage-ssl

Was this article helpful?

Help us to become even better and reviewing this page!