
Options -MultiViews
DirectoryIndex index.html index.php

<IfModule mod_dir.c>
DirectorySlash Off
</IfModule>

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# 1. Redirect URL dengan trailing slash
# ke URL tanpa trailing slash
# Homepage / tidak berubah
RewriteCond %{THE_REQUEST} "\s/+[^\s?]*?/[?\s]" [NC]
RewriteRule ^(.+)/$ /$1 [R=301,L,NE]

# 2. Folder dengan index.html
# diakses tanpa trailing slash
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_FILENAME}/index.html -f
RewriteRule ^(.+[^/])$ $1/index.html [END]

# 3. Folder dengan index.php
# diakses tanpa trailing slash
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_FILENAME}/index.php -f
RewriteRule ^(.+[^/])$ $1/index.php [END]

</IfModule>
