Skip to content
PHP Logo

Is it possible to activate access protection based on the file type in htaccess?

Yes, it is possible to activate access protection based on the file type in htaccess. This can be achieved by using the "FilesMatch" directive in the htaccess file to match specific file types and then applying access protection rules to them.

php
<FilesMatch "\.(jpg|png|gif)$">
    Order deny,allow
    Deny from all
</FilesMatch>