RewriteEngine On # Page RewriteCond %{DOCUMENT_ROOT}/page-$1.php -f RewriteRule ^page/([a-zA-Z0-9_-]+)/?$ /page-$1.php [L] ####################################### # 2. File PHP lain di root tanpa .php ####################################### RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^([a-zA-Z0-9_-]+)$ $1.php [L] ####################################### # 3. Hapus trailing slash (kecuali root) ####################################### RewriteCond %{REQUEST_URI} !^/$ RewriteRule ^(.+)/$ /$1 [R=301,L]