Configuring htaccess for SEO friendly PHP url

How would I configure the .htaccess file to make the url on one of my pages SEO friendly for example

PHP url:

mysite.com/view_profile.php?profile={$username}

SEO friendly url:

mysite.com/{$username}

Any help would be appreciated.

Use mod_rewrite : Apache’s mod_rewrite <- that is a good tutorial with examples

First you need to enable mod_rewrite.

The the following code will work for you.

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .+ - [L]
RewriteRule ^([^/]+)$ view_profile.php?profile=$1 [QSA,L]
</IfModule>