apache redirect http to https and www to non www

后端 未结 6 1637
陌清茗
陌清茗 2020-11-27 18:03

basically what i want is redirect al request to use HTTPS instead of http

I have this in my htaccess so far and it worked great: Code:



        
6条回答
  •  迷失自我
    2020-11-27 18:29

    Check out this:

    RewriteEngine On
    RewriteCond %{HTTP_HOST}#%{HTTPS}s ^www\.([^#]+)#(?:off|on(s)) [NC]
    RewriteRule ^ http%2://%1%{REQUEST_URI} [R=301,L]
    RewriteCond %{HTTPS} !=on
    RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
    

提交回复
热议问题