htaccess force https and redirect www to non-www, but no other subdomains

后端 未结 6 729
醉话见心
醉话见心 2020-12-01 11:03

I know there are many similar threads, but none of them seems to match my exact problem. Here is what I’m trying to do:

(1) http://www.mydomain.com/ -> ht         


        
6条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-01 11:43

    To Force using HTTPS

    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
    

    To Force www to non www

    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^www.bewebdeveloper.com$
    RewriteRule ^(.*) http://bewebdeveloper.com/$1  [QSA,L,R=301]
    

提交回复
热议问题