Web services NGINX-删除.html扩展名并添加尾部斜杠
我想从Web services NGINX-删除.html扩展名并添加尾部斜杠,web-services,web,nginx,rewrite,Web Services,Web,Nginx,Rewrite,我想从NGINX server { try_files $uri $uri/ $uri.html =404; } 现在website.com/privacy的处理方式与website.com/privacy.html相同,但是website.com/privacy/将返回404 但是,我想将privacy.html重写为website.com/privacy/ 注意尾随斜杠 privacy.html是一个文件,但website.com/privacy/是一个目录…目录必须exists@u
NGINX
server {
try_files $uri $uri/ $uri.html =404;
}
现在website.com/privacy
的处理方式与website.com/privacy.html
相同,但是website.com/privacy/
将返回404
但是,我想将privacy.html
重写为website.com/privacy/
- 注意尾随斜杠
privacy.html
是一个文件,但website.com/privacy/
是一个目录…目录必须exists@user2196728是的,我明白了。但是,如果/privacy/
不是现有目录,我希望NGINX
将其作为privacy.html
处理;事实上,我甚至不介意它跳过目录测试。这纯粹是为了美化URL
。