I am trying to hide .php in my URLS. it works with folowwing .htaccess in root files but not in subfolders. Like it works for https://example.com/demo but when i try to login or signup it dont work and gives 404. my login URL is below
https://example.com/demo/login.php ( then login.php page from root calls the login.php page in the inc folder)
Please guide
RewriteEngine On
# Unless directory, remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/$ http://example.com/folder/$1 [R=301,L]
# Redirect external .php requests to extensionless URL
RewriteCond %{THE_REQUEST} ^(.+)\.php([#?][^\ ]*)?\ HTTP/
RewriteRule ^(.+)\.php$ http://example.com/folder/$1 [R=301,L]
# Resolve .php file for extensionless PHP URLs
RewriteRule ^([^/.]+)$ $1.php [L]