Forum Moderators: phranque
RewriteRule ^(.*)$ [yoursite...] [L]
It basically takes anything (that's the .* where . = any char and * = 0 or more) and adds .html on the end of it.
Looks like a lot, but if you go through it slowly, you'll get it.
Options -MultiViews +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{HTTP_HOST} ^(.*)example\.com$
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ (.*)\.html
RewriteRule ^([^.]+)\.html$ http://example.com/$1 [QSA,R=301]
At least it seems to work well enough with .php for me.
If there's a request for a filename without an extension (and that doesn't describe an existing file/directory) the content for *.html is served. The second rewrite rule forcibly rewrites something like http://example.com/page.html to http://example.com/page and thus feeds back into the first rule.
It assumes the .htaccess is placed at root; you'd need to change the last line if that isn't the case. (Or possibly use RewriteBase; I don't take this route because I use an offline server to test on that has directories for several sites in its root directory.)