There is such a rewrite

RewriteEngine on RewriteCond %{HTTP_HOST} !^www.example.com$ [NC] RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?route=$1 [L,QSA] 

You must add http => https to it.

How to implement it? checked google, but the changes that I found led to the fact that the site was rebooting without end

Closed due to the fact that off-topic participants are Visman , tutankhamun , user207618, aleksandr barakin , cheops 11 Sep '16 at 6:16 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reasons:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - tutankhamun, community spirit, cheops
  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - Visman, aleksandr barakin
If the question can be reformulated according to the rules set out in the certificate , edit it .

    1 answer 1

     RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. [OR] RewriteCond %{HTTPS} !on RewriteRule ^ https://www.example.com%{REQUEST_URI} [R=301,L,QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?route=$1 [L,QSA] 

    or

     RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. [OR] RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^ https://www.example.com%{REQUEST_URI} [R=301,L,QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?route=$1 [L,QSA] 

    depending on which variable https is reflected.

    • Thanks for the answer. Sorry, but I have little knowledge of this part of what it means "in what variable https is reflected." And if it's not difficult for you to explain this condition: "% {SERVER_PORT}! ^ 443 $"? - Hasanagha Aliyev
    • 1st code issued by ERR_TOO_MANY_REDIRECTS - Hasanagha Aliyev
    • %{SERVER_PORT} variable that contains the value of the port number to which the request came. Usually 80 is the port responsible for http requests, and 443 for https requests. You can place the phpinfo(); command in the php script phpinfo(); and the browser to see the configuration of php, including variables from the SERVER array in which the SERVER_PORT / HTTPS variable is specified. - Visman September
    • Thanks, it means I need the first option with the changes, so that ERR_TOO_MANY_REDIRECTS error is not issued. Can you help? - Hasanagha Aliyev
    • @HasanaghaAliyev, why the first option, and not the second? Show the _SERVER array table, which is output by phpinfo (); when opening a page via https protocol. - Visman September