Edit .htaccess as follows:
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /$1.php [L]
After starting the rewrite mechanism, it first checks whether the requested file is an actual file in the system, or if it is actually a directory. If this is not the case, he will execute the rule, which in this case should try to find the file by adding .php and serving it.
Subdirectories, images, CSS, etc. will be okay because they will exit the dubbing after they are discovered.
source share