Making default go to https instead of http


#1

I installed lets encrypt on my site and works under https:// but how do I make the default https rather than it directing traffic to http://

any ideas ?


#2

Use an .htacces rule… there is more than one that will work.

Here is what I use:

RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://EXAMPLE.COM/$1 [R=permanent]

Replace EXAMPLE.COM with your site’s hostname.

Essentially: if (the traffic is NOT on port 443) then redirect to https:// preserving any extended URL or arguments being passed ($1).

http traffic will be on port 80, which is not 443.