The trick is as follows:
1. Copy this code:
This is for html files
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]
And this is for php files
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
2. Save with the name .htaccess, then upload in the root of your server
3. You can test it!