RewriteEngine On

# Keep one preferred public version of the site for search engines and visitors.
RewriteCond %{HTTPS} !=on [OR]
RewriteCond %{HTTP_HOST} !^www\.triplemstudios\.co\.uk$ [NC]
RewriteRule ^ https://www.triplemstudios.co.uk%{REQUEST_URI} [R=301,L,NE]

ErrorDocument 404 /404.html

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/css "access plus 1 year"
    ExpiresByType text/javascript "access plus 1 year"
    ExpiresByType application/javascript "access plus 1 year"
    ExpiresByType image/jpeg "access plus 1 year"
    ExpiresByType image/png "access plus 1 year"
    ExpiresByType image/svg+xml "access plus 1 year"
    ExpiresByType image/webp "access plus 1 year"
    ExpiresByType audio/mpeg "access plus 1 month"
</IfModule>

<IfModule mod_headers.c>
    Header always set Strict-Transport-Security "max-age=31536000"
    <FilesMatch "\.(html)$">
        Header set Content-Type "text/html; charset=UTF-8"
    </FilesMatch>
    <FilesMatch "\.(css|js|jpg|jpeg|png|svg|webp|ico)$">
        Header set Cache-Control "public, max-age=31536000"
    </FilesMatch>
    <FilesMatch "\.(mp3)$">
        Header set Cache-Control "public, max-age=2592000"
    </FilesMatch>
</IfModule>
