We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13226
    • 953 Posts
    I intend on changing one of my sites from "http" to "https" shortly, but am not sure how to go about changing the .htaccess file.

    At the moment I re-direct "non www" to "www" and as such the same should apply with https.

    My current re-write looks like this:

    Options +FollowSymlinks
    RewriteEngine On
    RewriteBase /
    RewriteCond %{HTTP_HOST} ^domain.com [NC]
    RewriteRule ^(.*) http://www.domain.com/$1 [R=301,L]


    Can anyone help out ?

    Does anyone already have an SEO friendly re-direct from "HTTP" to "HTTPS" including re-directing "non www" to "www" ?

    Just for info: this is the whole website, not just the manager

    Thanks for your time

    This question has been answered by fourroses666. See the first response.

    • discuss.answer
      • 9995
      • 1,613 Posts
      On configurationtab you can choose Server type: https but not sure if it does anything. Probably [(site_url)]?!

      Here my .htaccess which does the job for me:

      AddDefaultCharset utf-8
      
      RewriteEngine On
      RewriteBase /
      
      RewriteCond %{HTTP_USER_AGENT} ^.*internal\ dummy\ connection.*$ [NC]
      RewriteRule .* - [F,L]
      
      RewriteCond %{HTTP_HOST} !^$
      RewriteCond %{HTTP_HOST} !^www\. [NC]
      RewriteCond %{HTTP_HOST} (.+)$
      RewriteRule ^(.*)$ https://www.%1/$1 [R=permanent,L] . 
      
      RewriteRule ^(manager|assets)/.*$ - [L]
      RewriteRule \.(jpg|jpeg|png|gif|ico)$ - [L]
      
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
      
      
      RewriteCond %{HTTPS} !^on$
      RewriteRule (.*) https://www.domain-here.nl/$1 [R,L]
      
      RewriteCond %{SERVER_PORT} !=443
      RewriteRule (.*) https://www.domain-here.nl/$1 [R=301,L] 
      
      
      [ed. note: fourroses666 last edited this post 8 years, 2 months ago.]
        Evolution user, I like the back-end speed and simplicity smiley
        • 13226
        • 953 Posts
        I see you have "rewrite engine on" twice - is that necessary ?

        Can you break the following down ?

        RewriteRule ^(.*)$ https://www.%1/$1 [R=permanent,L] .

        Cheers
          • 9995
          • 1,613 Posts
          Aha, didn't see that, you can remove the lowest one.

          I have edited my post.
            Evolution user, I like the back-end speed and simplicity smiley