Options All -Indexes
AddType application/x-httpd-php82 .php

RewriteEngine On
RewriteRule ^users/([^/]+)/profile/?$ /profile.php?id=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [NC,L]