Hi,
I have a website where most files have a php extention, and want to remove the exention and add a slash using htaccess.
So for example instead of
http://mydomain.com/test.php
I’d like…
http://mydomain.com/test/
I’ve tried loads of scripts from the web. They seem to work in that they remove the .php, but kept getting a 404. So I removed the .php extention from one of the files so it didn’t get a 404 but the file wasn’t then treated as a php file and showed the php code in the browser.
RewriteEngine on
RewriteCond %{THE_REQUEST} [1]{3,9}\ /(.*)\.php\ HTTP/ [NC]
RewriteRule .+ http://www.mydomain.com/%1 [R=301,QSA]
Can anyone tell me what I’m doing wrong?
Thanks!
A-Z ↩︎