"Hide" .html file extensions using nginx rewrites

Solution 1:

try_files should be what you want.

Something like this:

try_files $uri.html $uri $uri/ =404;

Solution 2:

Per the comment from @Khaja, the best answer is:

try_files $uri.html $uri/ =404;

So that only one copy of the resource is served (that with no .html extension). You don't want to divide your link strength over multiple URLs serving duplicate content. Find the documentation here.