我如何将以下URL重定向到使用Nginx存在的路径

时间:2019-08-29 13:42:04

标签: nginx

想将https://mylocal.com重定向到https://mylocal.com/public/build/index.html

其中index.html的路径为/opt/domain/subdomain/public/build/index.html

尝试过

    location = / {
    return 301 /opt/domain/subdomain/public/build/index.html;

    }

它应该重定向到/ https://mylocal/public/build/index.html

1 个答案:

答案 0 :(得分:0)

https://mylocal.com至/ https://mylocal.com/public/build/index.html

location = /index.html {
  return 301 /public/build/index.html;
}