I would like to prevent direct access to .php files using .htaccess file . I know of other measures like taking the files out of the public folder or using code in each file, but for me this is the most comfortable.
By prevent access to files .php
I mean accessing any URL using .php
the end of the URL, since all other URLs are dynamic (they don't have .php
the end) In a nutshell, allow access to URLs like ejemplo.com/login
but not toejemplo.com/functions.php
This is what I've tried, but it doesn't work for me:
# Prevenir acceso a archivos php
<FilesMatch "\.(php)$">
Require all denied
<FilesMatch>
Mistake:
Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request.