I have the following site structure
index.php
services.php
contact.php
/admin
and the following in .htaccess:
RewriteEngine on
RewriteCond %{REQUEST_URI} !(\.[^./]+)$
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) /$1.php [L]
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^.]+\.)+php\ HTTP
RewriteRule ^(.+)\.php$ /$1 [R=301,L]
This successfully tidies up my URLs and directs to the correct pages.
However it prevents any functions being carried out in admin where $_POST and $_GET is being used a lot.
So is there a way to prevent the rule being carried out in /admin or restrict it to only being carried out in top level pages?
Just add this rule right after
RewriteEngine online (before both of your rules):