RewriteEngine On
RewriteBase /rise/

# 1. Block access to .php in URL
RewriteCond %{THE_REQUEST} \s/+(.+\.php) [NC]
RewriteRule ^ - [R=404,L]

# 2. Rewrite clean URL to .php file if it exists (supporting subdirectories)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*)$ $1.php [QSA,L]

# 3. Optional: Custom 404
ErrorDocument 404 /rise/404.html
