# User Directory Security
Options -Indexes

<IfModule mod_rewrite.c>
    RewriteEngine On
    
    # Remove .php extension
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}.php -f
    RewriteRule ^(.+)$ $1.php [L,QSA]
    
    # Redirect .php URLs to clean URLs
    RewriteCond %{THE_REQUEST} \s/+user/(.*?)\.php[\s?] [NC]
    RewriteRule ^ /user/%1 [R=301,L]
</IfModule>
