![无法在 404 时重定向回 index.html](https://linux22.com/image/750177/%E6%97%A0%E6%B3%95%E5%9C%A8%20404%20%E6%97%B6%E9%87%8D%E5%AE%9A%E5%90%91%E5%9B%9E%20index.html.png)
我尝试在foo
给出参数后将重定向返回到 index.html cloudshareimage/foo
,而不是 404....with foo
removed。或者任何其他参数。
知道为什么这在 nginx 上不起作用吗?
server {
listen 80;
server_name www.cloudshareimage.com cloudshareimage.com;
access_log /var/log/nginx/cloudimageshare.log;
client_header_buffer_size 128;
expires -1;
access_log /var/log/nginx/cloudimageshare.log;
root /var/www/cloudshareimage/app/static/;
error_page 404 = @notfound;
location / {
error_page 404 = @notfound;
}
location @notfound {
return 301 /;
}
}
- - [27/Mar/2020:07:54:50 -0500] "GET /foo HTTP/1.1" 404 233 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36"