
RewriteEngine on
RewriteCond %{HTTP_HOST} ^msos\.spletnimojster\.si$ [OR]
RewriteCond %{HTTP_HOST} ^www\.msos\.spletnimojster\.si$
RewriteRule ^/?$ "https\:\/\/msos\.spletnimojster\.si\/en\/" [R=301,L]


# ============================================================
# Static-site defaults (added for SEO / performance / 404).
# Wrapped in <IfModule> guards so a missing module can't 500.
# Ignored by nginx (harmless). No extra HTTPS/host redirects —
# the host handles TLS and the rule above handles the root.
# ============================================================

# ----- Custom branded error page -----
ErrorDocument 404 /404.html

# ----- Don't expose directory listings -----
Options -Indexes

# ----- Correct MIME types (WebP, SVG, manifest, fonts) -----
<IfModule mod_mime.c>
    AddType image/webp                 .webp
    AddType image/svg+xml              .svg
    AddType application/manifest+json  .webmanifest
    AddType image/x-icon               .ico
    AddType font/woff2                 .woff2
</IfModule>

# ----- Gzip / compression for text assets -----
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml
    AddOutputFilterByType DEFLATE application/javascript application/json
    AddOutputFilterByType DEFLATE application/xml application/manifest+json
    AddOutputFilterByType DEFLATE image/svg+xml
</IfModule>

# ----- Browser caching -----
# No file-hashing on this site, so keep CSS/JS short (updates must propagate)
# and cache images/fonts longer. HTML is always revalidated.
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/html                    "access plus 0 seconds"
    ExpiresByType text/css                     "access plus 1 day"
    ExpiresByType application/javascript       "access plus 1 day"
    ExpiresByType image/webp                   "access plus 1 month"
    ExpiresByType image/jpeg                   "access plus 1 month"
    ExpiresByType image/png                    "access plus 1 month"
    ExpiresByType image/svg+xml                "access plus 1 month"
    ExpiresByType image/x-icon                 "access plus 1 month"
    ExpiresByType font/woff2                   "access plus 1 month"
</IfModule>
<IfModule mod_headers.c>
    Header set X-Content-Type-Options "nosniff"
    <FilesMatch "\.html$">
        Header set Cache-Control "no-cache, must-revalidate"
    </FilesMatch>
</IfModule>
