# SLAVERO – konfiguracja serwera (Apache / LiteSpeed, np. vh.pl)
Options -Indexes
DirectoryIndex index.html index.php
ErrorDocument 404 /404.html
ErrorDocument 403 /404.html
AddDefaultCharset utf-8
AddType application/manifest+json .webmanifest
AddType font/woff .woff
AddType image/webp .webp

<IfModule mod_rewrite.c>
  RewriteEngine On
  # >>> SLV-HOST (HTTPS i jeden adres sklepu – wpisuje instalator)
  # <<< SLV-HOST
  # pliki ukryte, kopie i dzienniki – nigdy na zewnątrz (poza .well-known dla certyfikatu SSL)
  RewriteRule (^|/)\.(?!well-known(/|$)) - [F,L]
  RewriteRule ^slavero-prywatne(/|$) - [F,L]
  RewriteRule ^api/lib(/|$) - [F,L]
</IfModule>

<FilesMatch "(^\.|\.(bak|old|orig|swp|log|sql|tmp|md|lock|ini|sh|dist|json)$)">
  <IfModule mod_authz_core.c>Require all denied</IfModule>
  <IfModule !mod_authz_core.c>Order allow,deny
    Deny from all</IfModule>
</FilesMatch>

<IfModule mod_headers.c>
  Header always set X-Content-Type-Options "nosniff"
  Header always set Referrer-Policy "strict-origin-when-cross-origin"
  Header always set X-Frame-Options "SAMEORIGIN"
  Header always set Permissions-Policy "camera=(), microphone=(), geolocation=(), payment=(), usb=(), interest-cohort=()"
  Header always set Cross-Origin-Opener-Policy "same-origin"
  Header always set Content-Security-Policy "default-src 'self'; img-src 'self' data: blob:; script-src 'self' 'sha256-Du+OJKJSbdUgz5nrHeWWINvez6XKDDU/tyj/5c2uvwo='; style-src 'self' 'unsafe-inline'; font-src 'self'; connect-src 'self'; frame-ancestors 'self'; base-uri 'self'; form-action 'self'; object-src 'none'; upgrade-insecure-requests"
  Header always unset X-Powered-By
  Header unset X-Powered-By

  # cache: HTML i dane sklepu zawsze świeże, style i skrypty z ?v= na rok, zdjęcia i czcionki na długo
  <FilesMatch "\.(html|xml|txt|webmanifest)$">
    Header set Cache-Control "no-cache"
  </FilesMatch>
  <FilesMatch "\.(css|js)$">
    Header set Cache-Control "public, max-age=31536000, immutable"
  </FilesMatch>
  <FilesMatch "^data\.js$">
    Header set Cache-Control "no-cache"
  </FilesMatch>
  <FilesMatch "\.(webp|png|jpe?g|svg|ico)$">
    Header set Cache-Control "public, max-age=2592000"
  </FilesMatch>
  <FilesMatch "\.(woff2?|ttf)$">
    Header set Cache-Control "public, max-age=31536000, immutable"
  </FilesMatch>
  <FilesMatch "\.php$">
    Header set Cache-Control "no-store"
  </FilesMatch>
</IfModule>

<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/javascript text/javascript application/json application/xml application/manifest+json image/svg+xml
</IfModule>
