How to redirect all HTTP requests to HTTPS

前端 未结 26 2628
小鲜肉
小鲜肉 2020-11-22 00:40

I\'m trying to redirect all insecure HTTP requests on my site (e.g. http://www.example.com) to HTTPS (https://www.example.com). I\'m using PHP btw.

26条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-22 00:52

     Redirect 301 / https://example.com/
    

    (worked for me when none of the above answers worked)

    Bonus:

    ServerAlias www.example.com example.com
    

    (fixed https://www.example.com not found)

提交回复
热议问题