Nginx rewrite non-www-prefixed domain to www-prefixed domain

后端 未结 7 1195
旧时难觅i
旧时难觅i 2021-01-30 11:05

I see the Nginx HttpRewriteModule documentation has an example to rewrite a www-prefixed domain to a non-www-prefixed domain:

if ($host ~* www\\.(.*)) {
  set $h         


        
7条回答
  •  不要未来只要你来
    2021-01-30 11:33

    The nginx documentation cautions against the use of if for rewriting. Please see the link here: http://wiki.nginx.org/Pitfalls#Server_Name

提交回复
热议问题