Minimal .htaccess code for a set of redirection rules

I want to achieve the following behavior with the least number of rules:

  1. Enforce HTTPS
  2. Redirect www to non-www
  3. Remove .php and .html extensions from all URLs
  4. Redirect and to
  5. Redirect*.html to*
  6. Remove trailing slashes

Right now I use the following rules:

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]

RewriteCond %{THE_REQUEST} /([^.]+)\.html [NC]
RewriteRule ^ /%1 [R=301,L]
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*?)/?$ /$1.html

RewriteCond %{THE_REQUEST} ^.*/index
RewriteRule ^(.*)index /$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [R=301,L]

which don't include a rule for the static directory as I don't have introduced it yet. I plan to do it for caching reasons now.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum