RewriteEngine On

# BASE PATH (WAJIB kalau di localhost/wedding)
RewriteBase /wedding/

# Hilangkan index.php di URL
RewriteCond %{THE_REQUEST} /index\.php [NC]
RewriteRule ^index\.php$ /wedding/ [R=301,L]

# Routing ke index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]

# Disable directory listing
Options -Indexes

# Protect file penting
<FilesMatch "(^\.|\.env|database\.php)">
    Order allow,deny
    Deny from all
</FilesMatch>

# Blok folder config
RewriteRule ^config/ - [F,L]

# Error page
ErrorDocument 404 /wedding/index.php