nginx - redirect subdirectories path to single (in

2019-09-16 05:15发布

How to redirect all the sub directory path to single index.html file?

here is what i want nginx configuration:

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

this means if i hit /user OR /user/vishant OR /user/xyz/vishant it should render only index.html page.

The code i have written is not working but what i thought should be similar to this.

1条回答
乱世女痞
2楼-- · 2019-09-16 05:29
location /user/ {
    root /home/vishant/devcenter/baetter-share1;
    try_files /index.html =404;
}

Documentation:

查看更多
登录 后发表回答