How to hide file ext from the URL .php .html


I want to hide the file ext exp .php .html from the URL and am doing it using .htacces file but the only problem is that by using this code
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^.]+)$ $1.php [NC,L]
the browser can’t read my website folders.
the flash games in the URL is a folder on my website and I want to make an index page for it to appear like this
but because of the rewrite code above am getting error page the only way to enter that page is by typing index after the folder name
and that’s is not good for me does there any other way to hide the file
ext without changing anything on the website e.

**and thanks for help hope you got the idea **



RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]


not working all my files now return 404 error page not found


Then try

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [NC,L]