# Product videos: static media only, never executable.
Options -ExecCGI -Indexes
<FilesMatch "\.(php|phtml|phar|php[0-9]|cgi|pl|py)$">
    Require all denied
</FilesMatch>

# ---- Streaming / playback delivery ----------------------------------
# These files are served directly by the web server (not through PHP), which natively answers
# HTTP Range requests with "206 Partial Content" + Content-Range, so playback starts after the first
# bytes and seeking/resuming never re-downloads the whole video. The rules below make that explicit and safe.

# Correct MIME types (a wrong/missing type can make mobile browsers download the full file first)
<IfModule mod_mime.c>
    AddType video/mp4 .mp4 .m4v
    AddType video/webm .webm
</IfModule>

# Never compress video (compression disables byte ranges and wastes CPU on already-compressed media)
<IfModule mod_env.c>
    SetEnv no-gzip 1
    SetEnv dont-vary 1
</IfModule>

<IfModule mod_headers.c>
    <FilesMatch "\.(mp4|m4v|webm)$">
        # advertise byte-range support on every response
        Header set Accept-Ranges bytes
        # the Store URL carries ?v=<file mtime>, so a replaced video gets a new URL: long caching is safe
        Header set Cache-Control "public, max-age=2592000, immutable"
    </FilesMatch>
</IfModule>

# Stable validators (same on every request / server in a pool) so browsers can resume partial downloads
FileETag MTime Size
