Options +FollowSymLinks -MultiViews
RewriteEngine On

# Base directory - sesuaikan dengan struktur folder Anda
# RewriteBase /

# Redirect dari .php ke non-php
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R=301,L]

# Internally rewrite non-php ke .php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]

# Custom error page
ErrorDocument 404 /404.php