1RewriteCond %{THE_REQUEST} ^.*/index\.php
2RewriteRule ^(.*)index.php$ /$1 [R=301,L]
3RewriteCond %{THE_REQUEST} /([^.]+)\.php [NC]
4RewriteRule ^ /%1 [R=301,NC,L,R]
5RewriteRule ^(.*)\/(\?.*)?$ $1$2 [R=301,L]
6RewriteCond %{REQUEST_FILENAME}.php -f
7RewriteRule ^ %{REQUEST_URI}.php [NC,L]