RewriteEngine On

# Production hardening: configuration and source metadata are never public.
RewriteRule ^config(?:/|$) - [F,L,NC]
RewriteRule ^uploads/payment-proofs(?:/|$) - [F,L,NC]
RewriteRule ^uploads/support(?:/|$) - [F,L,NC]
RewriteRule ^uploads/audits(?:/|$) - [F,L,NC]
# Only the updater matching the deployed VERSION may be called directly.
RewriteRule ^update-v(?!0\.5\.50\.php$)[^/]+\.php$ - [F,L,NC]
RewriteRule ^(?:schema\.sql|VERSION|CHANGELOG\.md|README\.md)$ - [F,L,NC]


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^m/([a-z0-9-]+)/?$ index.php?masjid=$1 [QSA,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^m/([a-z0-9-]+)/(.*)$ $2?masjid=$1 [QSA,L]
