htaccess url rewrite/redirect - like facebook does
I have a url like www.example.com/mypage.php?id=324

That number 324 is auto incremented (meaning that person is 324th user of the website), and each user can set own user url, which is stored in mysql table (alphanumeric only).

Let's say, user number 324 has user url 'peter'

I am trying to replace mypage.php?id=324 to peter, so the url can be displayed like www.example.com/peter

But I still want to maintain mypage.php?id=324 internally, so if someone types www.example.com/mypage.php?id=324, it can be redirected to www.example.com/peter

I guess this is vanity url like facebook does?

I've searched all over the web, and even bought a book about htaccess, but I still couldn't figure this out. Please help me! Thank you so much in advance!
htaccess url rewrite/redirect - like facebook does
===

I have a url like www.example.com/mypage.php?id=324

That number 324 is auto incremented (meaning that person is 324th user of the website), and each user can set own user url, which is stored in mysql table (alphanumeric only).

Let's say, user number 324 has user url 'peter'

I am trying to replace mypage.php?id=324 to peter, so the url can be displayed like www.example.com/peter

But I still want to maintain mypage.php?id=324 internally, so if someone types www.example.com/mypage.php?id=324, it can be redirected to www.example.com/peter

I guess this is vanity url like facebook does?

I've searched all over the web, and even bought a book about htaccess, but I still couldn't figure this out. Please help me! Thank you so much in advance!