DirectoryIndex index.php
RewriteEngine On

# Redirect www ke non-www
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,R=301]

# Paksa HTTPS
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# ==== Fix routing agar folder seperti about-us, faq, author bisa diakses ====
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+)/$ $1/index.php [L]

# Kalau file atau foldernya memang ada, jangan di-redirect
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Semua URL lain diarahkan ke index.php
RewriteRule ^ index.php [L]

# Error pages
ErrorDocument 404 /
ErrorDocument 500 /

# PHP handler bawaan cPanel
<IfModule mime_module>
  AddHandler application/x-httpd-ea-php84 .php .php8 .phtml
</IfModule>
