I have written a rule that allows my .php pages to be viewed without the file extension.
e.g.
/test-page.php is rewritten to /test-page/
I'm also redirecting non www to www. However, if I try to directly access test-page.php this doesn't get redirected - am I missing anything obvious?
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mysite.co.uk [NC]
RewriteRule ^(.*)$ https://www.mysite.co.uk/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]