RewriteEngine On RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^.*$ $0.php [L,QSA] RewriteCond %{THE_REQUEST} ([^s]*).php(?[^s]*)? RewriteRule (.*) %1 [R=301,L].