How to remove .html from URL by using .htaccess

To remove .html from the URL of a page. Also, need to redirect any url with .html to the one without for example. to

NOTE: When your are testing .htaccess file do not use 301 redirects. Use 302 until finished testing, as the browser will cache 301s.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ /foldername/$1 [L,R=301]

Leave a Reply