# Disable directory browsing 
Options -Indexes

<IfModule mod_headers.c>
    Header unset Host
    Header unset ETag
    Header unset P3P
    Header unset Public-Key-Pins
    Header unset Public-Key-Pins-Report-Only
    Header unset X-Powered-By
    Header unset X-Runtime
    Header unset X-Version
    Header set Referrer-Policy "same-origin, no-referrer, strict-origin-when-cross-origin"
    Header set X-XSS-Protection "1; mode=block"
    Header set X-Content-Type-Options "nosniff"
    Header set X-Download-Options "noopen"
    Header set Access-Control-Allow-Methods "GET, POST, HEAD, OPTIONS"

    <FilesMatch "\.(ttf|otf|eot|woff|woff2|css|js|xml|json|srt|vtt|ass|dfxp|sub|stl|ttml|sbv|txt|jpg|jpeg|png|webp|gif)$">
        <IfModule mod_headers.c>
            Header set Access-Control-Allow-Credentials "false"
            Header set Access-Control-Allow-Origin "*"
            Header set Access-Control-Expose-Headers "*"
        </IfModule>
    </FilesMatch>
</IfModule>

<IfModule mod_deflate.c>
    SetOutputFilter DEFLATE
    AddOutputFilterByType DEFLATE text/html text/css text/javascript text/plain text/xml application/json application/x-javascript application/x-httpd-php
    BrowserMatch ^Mozilla/4 gzip-only-text/html
    BrowserMatch ^Mozilla/4\.0[678] no-gzip
    BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
    BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
</IfModule>

<IfModule mod_expires.c>
    ExpiresActive On
    # ExpiresDefault "access plus 1 day"
    ExpiresByType font/woff "access plus 1 year"
    ExpiresByType font/woff2 "access plus 1 year"
    ExpiresByType image/x-icon "access plus 1 year"
    ExpiresByType image/jpg "access plus 1 year"
    ExpiresByType image/jpeg "access plus 1 year"
    ExpiresByType image/gif "access plus 1 year"
    ExpiresByType image/png "access plus 1 year"
    ExpiresByType image/svg+xml "access plus 1 year"
    ExpiresByType text/css "access plus 1 year"
    ExpiresByType text/js "access plus 1 year"
    ExpiresByType text/xml "access plus 1 year"
    ExpiresByType text/javascript "access plus 1 year"
    ExpiresByType application/javascript "access plus 1 year"
    ExpiresByType application/x-javascript "access plus 1 year"
    ExpiresByType application/xml "access plus 1 year"
    ExpiresByType application/rss+xml "access plus 1 year"
</IfModule>

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^hls/(.*)?$ - [E=no-gzip:1]
    RewriteRule ^segments/(.*)?$ - [E=no-gzip:1]
    RewriteRule ^videoplayback/(.*)?$ - [E=no-gzip:1]
    RewriteRule ^cache/(.*)?$ / [F,L]
    RewriteRule ^tmp/(.*)?$ / [F,L]
    RewriteRule ^includes/(.*)?$ / [F,L]
    RewriteRule ^vendor/(.*)?$ / [F,L]
    RewriteRule ^composer\.(lock|json)$ / [F,L]
    RewriteCond %{REQUEST_FILENAME} !-l
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule .* index.php [L,QSA]
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
    SetEnvIf REDIRECT_no-gzip 1 no-gzip
</IfModule>
