.htaccess to require WWW for domain, but allow subdomain if existing with no hard coding

后端 未结 2 1571
死守一世寂寞
死守一世寂寞 2021-01-14 19:56

I\'m trying to figure it out how to set up an .htaccess set of rules that would force the presence of the \"www\" in front of the domain if it is not initially specified, bu

2条回答
  •  孤独总比滥情好
    2021-01-14 20:27

    RewriteCond %{HTTP_HOST} ^example\.org
    RewriteRule ^ http://www.example.org%{REQUEST_URI} [L,R=301]
    

    This will not redirect subdomains like mail.example.org

提交回复
热议问题