<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Jika Laravel disimpan di public_html dan index.php langsung di sana
    RewriteBase /

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Pastikan permintaan yang bukan file atau folder diarahkan ke index.php
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

<IfModule mime_module>
    AddHandler application/x-httpd-php82 .php
</IfModule>

<FilesMatch "\.(env|php~|bak|ini|log|sh)$">
Deny from all
</FilesMatch>

# Matikan directory browsing
Options -Indexes
