Options +FollowSymLinks
RewriteEngine On

ErrorDocument 404 /error/404.php

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

# Resolve .php file for extensionless php urls
RewriteRule ^([^/.]+)$ $1.php [L]

RewriteRule ^profile/([A-z0-9]+)$ profile.php?username=$1 [NC]