1RewriteEngine On
2RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\ HTTP/
3RewriteRule ^(.*)index$ http://example.com/$1 [L,R=301]
4
5RewriteCond %{REQUEST_FILENAME} !-d
6RewriteRule ^([^/]+)/$ http://example.com/$1 [L,R=301]
7
8RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.+)\.php\ HTTP/
9RewriteRule ^(.+)\.php$ http://example.com/$1 [L,R=301]
10RewriteRule ^([a-z]+)$ /$1.php [L]
11