Redirect .html to none html on URL


I tried to remove .html from my categories from admin panel and it works. now I have example.com/test , but example.com/test.html is 404 now. how can I redirect all .html urls to non html one?
should I do it from nginx? how?