Best way to force SSL in version 3.3?

Hello,


What is the best way to force https on the domain with the version 3.3 please?


Thank you.

Comments

  • Any generic server script shall do. If using Apache ... search for .htaccess + force https

    https://lmgtfy.com/?q=.htaccess+force+https

  • Thanks for that:-)

  • ianw5555ianw5555
    edited January 2020

    This will force https and www. (or non www.)


    <IfModule mod_rewrite.c>

    <IfModule mod_env.c>

    SetEnv HTTP_MOD_REWRITE On

    </IfModule>


    RewriteEngine on


    <IfModule mod_rewrite.c>

       RewriteCond %{HTTPS} off [OR]

       RewriteCond %{HTTP_HOST} ^domain.com [NC]

       RewriteRule (.*) https://www.domain.com/$1 [L,R=301]

    </IfModule>

    For non www.

    <IfModule mod_rewrite.c>

       RewriteCond %{HTTPS} off [OR]

       RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC]

        RewriteRule (.*) https://domain.com/$1 [L,R=301]

    </IfModule>

Sign In or Register to comment.