Nginx no-www to www and www to no-www

前端 未结 17 2498
予麋鹿
予麋鹿 2020-11-22 09:53

I am using nginx on Rackspace cloud following a tutorial and having searched the net and so far can\'t get this sorted.

I want www.mysite.com to go to mysite.com as

17条回答
  •  南方客
    南方客 (楼主)
    2020-11-22 10:01

    not sure if anyone notice it may be correct to return a 301 but browsers choke on it to doing

    rewrite ^(.*)$ https://yoursite.com$1; 
    

    is faster than:

    return 301 $scheme://yoursite.com$request_uri;
    

提交回复
热议问题