# Driver Training Australia: processed image uploads only.
# The admin writes only re-encoded .jpg and .webp files with random names here.
# Nothing in this folder may run as a script, and only those image files are served.

Options -Indexes -ExecCGI -Includes

# Stop PHP and other handlers from running anything here (Apache handler, CGI/FastCGI and LiteSpeed setups)
RemoveHandler .php .phtml .phar .php3 .php4 .php5 .php7 .php8 .pht .pl .py .cgi .sh .shtml
RemoveType .php .phtml .phar .php3 .php4 .php5 .php7 .php8 .pht
<IfModule mod_php.c>
    php_flag engine off
</IfModule>
<IfModule mod_php7.c>
    php_flag engine off
</IfModule>
<IfModule mod_php8.c>
    php_flag engine off
</IfModule>

# Deny everything, then allow only generated image names
Require all denied
<FilesMatch "^u[0-9a-f]{16}-v[0-9]+-m?[0-9]+\.(jpg|webp)$">
    Require all granted
    <IfModule mod_headers.c>
        Header set X-Content-Type-Options "nosniff"
        Header set Cache-Control "public, max-age=31536000, immutable"
    </IfModule>
</FilesMatch>
<IfModule mod_mime.c>
    AddType image/jpeg .jpg
    AddType image/webp .webp
</IfModule>
