This should work:
RewriteEngine On
RewriteCond %{THE_REQUEST} ^(GET|POST)\ /profile\.php\?username=(.*)\ HTTP
RewriteRule ^ /%2\? [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /profile.php?user=$1 [L]