# BEGIN WordPress
# De richtlijnen (regels) tussen "BEGIN WordPress" en "END WordPress" worden
# dynamisch gegenereerd en zouden alleen aangepast mogen worden via WordPress filters.
# Alle wijzigingen aan de richtlijnen tussen deze markeringen worden overschreven.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

# -------------------------------------------------------------
#  UNIVERSAL HIGH-PERFORMANCE .HTACCESS FOR WORDPRESS
#  Safe for Divi, WP Rocket, Yoast, Events Calendar, etc.
# -------------------------------------------------------------

# -------------------------------------------------------------
# 1. BASIC WORDPRESS RULES (leave untouched)
# -------------------------------------------------------------
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>


# -------------------------------------------------------------
# 2. SECURITY: Disable directory browsing
# -------------------------------------------------------------
Options -Indexes


# -------------------------------------------------------------
# 3. GZIP / BROTLI COMPRESSION
# -------------------------------------------------------------
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/xml
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/json
</IfModule>

<IfModule mod_brotli.c>
  BrotliCompressionQuality 5
  AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/xml text/css text/javascript application/javascript application/json
</IfModule>


# -------------------------------------------------------------
# 4. EXPIRES + CACHE-CONTROL HEADERS
# -------------------------------------------------------------
<IfModule mod_expires.c>
  ExpiresActive On

  # Images
  ExpiresByType image/jpg "access plus 1 year"
  ExpiresByType image/jpeg "access plus 1 year"
  ExpiresByType image/png "access plus 1 year"
  ExpiresByType image/gif "access plus 1 year"
  ExpiresByType image/webp "access plus 1 year"
  ExpiresByType image/svg+xml "access plus 1 year"

  # Fonts
  ExpiresByType font/ttf "access plus 1 year"
  ExpiresByType font/otf "access plus 1 year"
  ExpiresByType font/woff "access plus 1 year"
  ExpiresByType font/woff2 "access plus 1 year"

  # CSS & JS
  ExpiresByType text/css "access plus 1 year"
  ExpiresByType text/javascript "access plus 1 year"
  ExpiresByType application/javascript "access plus 1 year"

  # JSON
  ExpiresByType application/json "access plus 1 month"

  ExpiresDefault "access plus 2 days"
</IfModule>

# Cache-Control
<IfModule mod_headers.c>
  <FilesMatch "\.(js|css|png|jpg|jpeg|gif|svg|webp|woff|woff2|ttf|otf)$">
    Header set Cache-Control "public, max-age=31536000, immutable"
  </FilesMatch>
</IfModule>


# -------------------------------------------------------------
# 5. ETag verwijderen (voorkomt dubbele validatie)
# -------------------------------------------------------------
<IfModule mod_headers.c>
  Header unset ETag
</IfModule>
FileETag None


# -------------------------------------------------------------
# 6. SECURITY HEADERS (veilig, breekt niks)
# -------------------------------------------------------------
<IfModule mod_headers.c>
  Header always set X-Frame-Options "SAMEORIGIN"
  Header always set X-XSS-Protection "1; mode=block"
  Header always set X-Content-Type-Options "nosniff"
  Header always set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>


# -------------------------------------------------------------
# 7. HOTLINK PROTECTION (optioneel – mag je uitzetten)
# -------------------------------------------------------------
#<IfModule mod_rewrite.c>
#RewriteEngine on
#RewriteCond %{HTTP_REFERER} !^$
#RewriteCond %{HTTP_REFERER} !example\.nl [NC]
#RewriteRule \.(jpg|jpeg|png|gif|webp)$ - [F]
#</IfModule>


# -------------------------------------------------------------
# END
# -------------------------------------------------------------
RewriteCond %{HTTP_HOST} ^coraverburg\.nl$ [OR]
RewriteCond %{HTTP_HOST} ^www\.coraverburg\.nl$
RewriteRule ^/?$ "https\:\/\/isimedia\.nl\/domeinnaamregistratie\/" [R=301,L]

