2023-04-13 更新 126 阅读

该方法是在 Nginx 下设置的

  1. 如果你是使用的面板,把默认站点设置为:未设置默认站点
  2. 打开 Nginx 配置文件
  3. 找到 server 段,新增或修改以下代码:
server
    {
        listen 80;
        server_name www.xaoce.com xaoce.com;
        charset utf-8;
        index index.html index.htm index.php;
        if ($http_host !~ “^www\.xaoce\.com$”){
        rewrite ^(.*) https://xaoce.com$1 redirect;
        }
  1. 在用 IP 地址浏览你的站点,惊喜就来了。