Nginx and 404 on try_files with .html


Nginx and 404 on try_files with .html

给定此SEF URL /attrazioni/madame-tussauds-londra.html我需要调用真正的URL /index.php?q=/attrazioni/madame-tussauds-londra.html

我有这个指令,但只适用于没有扩展名的SEF URL,在这种情况下,/attrazioni/madame-tussauds-londra/

location {
    try_files $uri $uri/ /index.php?q=$request_uri;
}

我错了吗?为什么与跟踪.html的url不工作,并返回一个404页面?

没什么大不了的。在try_files之后,我的配置包含了以下内容:

location ~* '.(html|htm|txt)$ {
    add_header Cache-Control "public, must-revalidate, proxy-revalidate";
    access_log off;
    expires 1d;
    break;
}