RewriteEngine On # remove trailing slash (/) if no such folder exists RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)/$ /${lc:$1} [NC,L,R=301] # internally rewrite to a php script if it exists and convert to lower case RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.+)$ /${lc:$1}.php [NC,L] # redirect to .php-less link if requested directly RewriteRule ^(.+)\.php$ ${lc:$1} [NC,L,R=301]