apache – How to release access to specific FOLDER or FILE using .htaccess?

Question:

I have a .htaccess in my development environment.

Now I need to free up a site directory, actually a specific PHP file.

I'm using this code in .htaccess, I'm releasing several extensions, if I release the PHP extension, it accesses the file, but I don't want all PHP files to be released, I would like a specific one to be released.

order deny,allow
deny from all
<files ~ ".(xml|css|jpe?g|png|gif|js|otf|woff|svg)$">
allow from all
</files>

Answer:

Block access to .PHP files:

<Files *.php> 
    deny from all
</Files>

Authorize a specific file:

<Files "meuFicheiro.php">
    Order Allow,Deny
    Allow from all
</Files>
Scroll to Top