0

I am trying to remove the php extensions for ALL files in different subfolders. The httaccess file is located in the root folder and it works JUST for the php files in the root directory but not for the subfolders.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

Works: http://url/login.php -> http://url/login

Don’t work: http://url/admin/overview.php -> http://url/admin/overview -> Internal Server Error

Tobi
  • 13
  • 4
  • What error did you encounter? – Koala Yeung Sep 26 '19 at 04:34
  • 2
    Possible duplicate of [Remove .php extension with .htaccess](https://stackoverflow.com/questions/4026021/remove-php-extension-with-htaccess) –  Sep 26 '19 at 04:47
  • Unfortunately, it's not a copy of my issue. I am looking for a solution for ALL pages in different folders. Couldn't find anything on StackOverflow so far. – Tobi Sep 26 '19 at 07:13
  • The code you posted will work for folder hierarchies too, though it certainly can be enhanced. So there has to be some other influence causing trouble here. We cannot tell you what the issue is, you will have to start debugging. First thing would be to enable rewrite logging in your server and to learn on a step by step base what is going on inside your rewriting engine: https://cwiki.apache.org/confluence/display/HTTPD/RewriteLog – arkascha Sep 26 '19 at 07:41

0 Answers0