Options -Indexes
DirectoryIndex index.php

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteRule ^update/?$ update/index.php [QSA,L]

# Do not route the installer back through the front controller.
# Without this exception / -> /install/ -> index.php -> /install/ caused ERR_TOO_MANY_REDIRECTS.
RewriteRule ^install(?:/.*)?$ - [L,NC]

RewriteRule ^(?:app|config|modules|storage|themes)/ - [F,L,NC]

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

RewriteRule ^(?:downloads|forum|members|member|friends|feed|chat|messages|albums|album|profile|post|notifications|communities|community|gifts)(?:/.*)?$ index.php [QSA,L]

RewriteRule ^(?:app|config|modules|storage|themes)/ - [F,L,NC]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/update(?:/|$)
RewriteRule ^ index.php [QSA,L]
</IfModule>

<FilesMatch "(^\\.|composer\\.(json|lock)$|README\\.md$|SECURITY\\.md$|VERSION$|EDITION$|DEMO_EDITION$|.*\\.(?:sql|bak|backup|old|orig|save|log|ini|env|dist)$)">
Require all denied
</FilesMatch>

<IfModule mod_headers.c>
Header always set X-Content-Type-Options "nosniff"
Header always set X-Frame-Options "SAMEORIGIN"
Header always set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>


# NovaCMS Performance: static asset caching
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/css text/javascript application/javascript application/json application/xml image/svg+xml
</IfModule>
<IfModule mod_brotli.c>
AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/css text/javascript application/javascript application/json application/xml image/svg+xml
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css "access plus 7 days"
ExpiresByType application/javascript "access plus 7 days"
ExpiresByType image/jpeg "access plus 30 days"
ExpiresByType image/png "access plus 30 days"
ExpiresByType image/gif "access plus 30 days"
ExpiresByType image/webp "access plus 30 days"
ExpiresByType image/svg+xml "access plus 30 days"
ExpiresByType font/woff2 "access plus 90 days"
</IfModule>
<IfModule mod_headers.c>
<FilesMatch "\.(?:css|js|jpg|jpeg|png|gif|webp|svg|woff2)$">
Header set Cache-Control "public, max-age=604800, stale-while-revalidate=86400"
</FilesMatch>
</IfModule>
