Options -MultiViews
RewriteEngine On

# Mantém os endereços públicos sem a extensão .php.
RewriteCond %{THE_REQUEST} \s/+index\.php[?\s] [NC]
RewriteRule ^index\.php$ ./ [R=302,L]
RewriteCond %{THE_REQUEST} \s/+(.+?)\.php[?\s] [NC]
RewriteRule ^(.+)\.php$ $1 [R=302,L,NE]

# Processa internamente as rotas amigáveis pelos respetivos ficheiros PHP.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]
