If what you're looking for is exactly this:
example.com/name
You will need to change your profile.php to only expect the name variable, and use it to query the database.
I believe previously you had something like:
mysql_query("SELECT * from table where id=$id");
You will need to change it to be
mysql_query("SELECT * from table where name$name");
So you are telling your page to query the user by the name, instead of by the ID.
There's a few drawbacks related to this, as your query won't be as fast as it used to be, as I believe your name column is not the primary key, therefore no indexing.
Twitter uses Rails, so they will be calling it in a slightly different way using something like (onMissingMethod):
get_user_by_username()
Which isn't great either, as it's still querying the database by a string, but has some performance improvements to enable rails to do that.
Your htaccess will then looki like:
RewriteRule ^(.*) profile.php?name=$1
Hope that answers your question