【问题标题】:nginx - redirect subdirectories path to single (index.html) filenginx - 将子目录路径重定向到单个(index.html)文件
【发布时间】:2017-02-06 07:18:34
【问题描述】:

如何将所有子目录路径重定向到单个 index.html 文件?

这是我想要的 nginx 配置:

location /user/* {
    alias /home/vishant/devcenter/baetter-share1;
    index index.html;
}

这意味着如果我点击 /user OR /user/vishant OR /user/xyz/vishant 它应该只呈现 index.html 页面。

我写的代码不起作用,但我认为应该与此类似。

【问题讨论】:

    标签: nginx url-rewriting nginx-location


    【解决方案1】:
    location /user/ {
        root /home/vishant/devcenter/baetter-share1;
        try_files /index.html =404;
    }
    

    文档:

    【讨论】:

      猜你喜欢
      • 2014-11-26
      • 1970-01-01
      • 2019-01-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多