I'm trying to achieve a setup with nginx to:
- use index.html for '/'
- clean up .html urls
- default to 404 if no corresponding file is found
My server block looks like this:
server {
listen 80;
server_name 127.0.0.1;
index index.htm;
location / {
root "static";
try_files $uri.html =404;
}
}
Right now, visiting '/' goes to 404. I've tried common solutions like:
try_files $uri.html $uri/ =404;
but these allow both '/page' and '/page.html' as valid urls and I want to avoid duplicates.
Any suggestions?