nginx部署刷新404之重定向
- 重定向配置如下:
1、如果是在根目录则配置如下
location / {
root /;
index index.html;
try_files $uri $uri/ /index.html
}
2.如果是有特定目录
location /xx/xx/ {
root /;
index index.html;
try_files $uri $uri/ /xx/xx/index.html
}
例如:
location /payfor/ {
root /home/web;
index index.html;
try_files $uri $uri/ /payfor/index.html;
}