# Prevent direct access to PHP files
<FilesMatch "\.(php|php3|php4|php5|phtml|inc)$">
    Order Deny,Allow
    Deny from all
</FilesMatch>

# Allow direct access to images and documents
<FilesMatch "\.(jpg|jpeg|png|gif|webp|pdf|doc|docx|txt)$">
    Order Allow,Deny
    Allow from all
</FilesMatch>