DirectoryIndex index.php

RewriteEngine On
RewriteBase /just/

# 1. Redirect external requests from *.php to clean URL (e.g., /withdrawal.php -> /withdrawal, /admin.php -> /admin)
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+(?:just/)?([^.]+)\.php [NC]
RewriteRule ^ %1 [R=301,L]

# 2. Internally route extensionless requests to the corresponding .php file
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php [L,QSA]
