# Protect uploads directory
# Allow only image files to be accessed directly

# Deny access to all files by default
<FilesMatch ".*">
    Order Deny,Allow
    Deny from all
</FilesMatch>

# Allow access to image files only
<FilesMatch "\.(jpg|jpeg|png|gif|svg)$">
    Order Allow,Deny
    Allow from all
</FilesMatch>

# Prevent execution of PHP files
<FilesMatch "\.php$">
    Order Deny,Allow
    Deny from all
</FilesMatch>

# Set proper headers for images
<FilesMatch "\.(jpg|jpeg|png|gif|svg)$">
    Header set Cache-Control "public, max-age=31536000"
    Header set Content-Type "image/$1"
</FilesMatch> 