问题
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:
location /user/ {
root /home/vishant/devcenter/baetter-share1;
try_files /index.html =404;
}
Documentation:
- location
- root
- try_files
来源:https://stackoverflow.com/questions/39745315/nginx-redirect-subdirectories-path-to-single-index-html-file