Forum Moderators: phranque
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(([^/]+/)*)index\.(s?html?|php[45]?)\ HTTP/
RewriteRule index\.(s?html?|php[45]?)$ http://www.example.com/%1 [R=301,L]
RewriteCond %{HTTP_HOST} !^www\.example\.com$
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(([^/]+/)*)index\.(s?html?|php[45]?)\ HTTP/
RewriteRule .* http://www.example.com/%1 [R=301,L]
RewriteCond %{HTTP_HOST} !^www\.example\.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
RewriteRule ^(.*)index\.(s?html?|php[45]?)$ http://www.example.com/$1 [R=301,L]
^[A-Z]{3,9}\ /(([^/]+/)*)index\.(s?html?|php[45]?)\ HTTP/ it can be parsed fom left to right in one cycle.