Redirect all pages with .html to pages without .html
Redirect all requests from pages with .html extension to pages without any extension by means of .htaccess:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ /$1 [R=301,L]
Commentary
Enable runtime rewriting engine:
RewriteEngine On
If request does not match an existing file on the server:
RewriteCond %{REQUEST_FILENAME} !-f
If request does not match an existing folder on the server:
RewriteCond %{REQUEST_FILENAME} !-d
Then redirect request from page with .html to page without .html:
RewriteRule ^(.*)\.html$ /$1 [R=301,L]
Links
- Apache Module mod_rewrite docs: httpd.apache.org/docs/current/mod/mod_rewrite.html
- Stackoverflow.com: How to remove .html from URL?
Web servers
- Apache