I'm trying to make a "nice URL" using .htaccess file. I have already written a code that works and is stable, but I can not delete the extension .html. I wrote a code that removes the extension .html, but sometimes it causes error 500. I also wrote a code that after entering the URL without extension .html opens the page content, but at the address with the added .html is also the same content (the page is doubled). I want to enter the contents of the abc.html page after entering the address http://example.com/abc (but the address bar still has to be http://example.com/abc. After entering the address http://example.com/ abc.html I want to redirect to http://example.com/abc (this address should be in the address bar.).
My last question related to this topic
My current .htaccess file:
# rewrite engine initiation
RewriteEngine on
RewriteBase /
#canceling www
RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# handle trailing slashes (if not a directory)
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ $1 [R,L]
#canceling index or index.html
RewriteRule ^index.(php|html|htm)$ / [R=301,L,NC]
RewriteRule ^index$ / [R=301,L,NC]
What should I add to this code to get rid of the .html extension (so that it works always and does not cause errors)?
Edit: My problem is more specific. Solutions found in other topics are not working. I do not want the contents of the abc.html file to be available at exaple.com/abc.html and example.com/abc. It should be available only under example.com/abc.