I know that this could probably be solved in a second if I had access to the server configuration, but, unfortunately, I do not, so I have to solve this only with .htaccess.
I am creating an MVC-style site, that is, I have my own index.php in the root, models in the models directory, views in the views directory, etc. The fact is that I have several folders that should be publicly accessible, for example, css, javascript and images. Since Iโve completely forgotten, I prefer to blacklist everything and then whiten only what I want to be public (I rather get an error message when I first try to access the image, because I forgot its white list than forget about black my configuration list is directory and have all sorts of sensitive things).
My .htaccess file in the root now looks like this:
<filesMatch "\..+$">
deny from all
</FilesMatch>
<filesMatch "^index\.(htm|html|shtml|wml|pwml|php|php3|php4|php5)$">
allow from all
</filesMatch>
<Files "tests.php">
allow from 127.0.0.1
</files>
, , . - , , .htaccess, , , . , ?