Remove .php from url in .htaccess?

I have tried a lot of tiny tricks for removing the .php from a url, but nothing I have tried has worked like I would have hoped. I would like http.php to redirect to http.

What I have I tried:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [L,R=301]


RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule !.*\.php$ %{REQUEST_FILENAME}.php [QSA,L]


RewriteCond %{REQUEST_FILENAME} .php$
RewriteRule ^(.*)$ $1 

and I would like to reiterate that NOTHING WORKS!

Do any of you have a solution?

PS. I do have RewriteEngine on, I know this because my site does redirect to https.

Try this

Options +MultiViews +FollowSymLinks

RewriteEngine On
RewriteBase /

RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+).php [NC]
RewriteRule ^ %1 [R,L,NC]


This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.