Pretty Routes for
Static HTML in Nginx
HTML pages without the extension look prettier. For instance:
example.com/foo
instead of:
example.com/foo.html
Option A
Upload the HTML files without the extension,
and in your nginx.conf, set:
default_type
'text/html';
Option B (alias alike)
If you need to serve both routes, /cards and
/cards.html, in Nginx set:
try_files $uri.html $uri =404;
That attempts to find a file with the “.html” extension appended. The caveat is that it won’t send a 301 (redirect) status code. So for SEO purposes it may hurt having two routes. For that, see how to redirect.