Force SSL/https using .htaccess and mod_rewrite

后端 未结 9 1852
一向
一向 2020-11-22 05:24

How can I force to SSL/https using .htaccess and mod_rewrite page specific in PHP.

9条回答
  •  半阙折子戏
    2020-11-22 05:53

    Simple one :

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^(www\.example\.com)(:80)? [NC]
    RewriteRule ^(.*) https://example.com/$1 [R=301,L]
    order deny,allow
    

    replace your url with example.com

提交回复
热议问题