Forcing HTTPS over HTTP

后端 未结 4 871
广开言路
广开言路 2021-01-23 21:06

So I want to force the user to access the https version of my page rather than the http. And according to this post all I have to do is this:

RewriteEngine On 
R         


        
4条回答
  •  春和景丽
    2021-01-23 21:34

    You can leave it in the root directory but change it to:

    RewriteRule ^(your-directory/.*)$ https://www.yourdomain.com/$1 [R,L]
    

    Keep in mind, though, that before the redirect happens, the cookies and query parameters with possibly sensitive data has already been sent in clear text, so remember to use the secure cookie atribute if you use cookies.

提交回复
热议问题