如何在地址栏中隐藏GET变量[重复]

Possible Duplicate:
How to change appearance of URL from within a PHP script

I have this in my address bar

localhost/somedirectory/main.php?id=123456

how to hide those GET variables, so it becomes

localhost/somedirectory/main/123456

I know .htaccess is the answer but my attempts so far are to no avail. Could someone please shed some light on how to achieve it?

No way to do it with PHP the way you want!

Only htaccess will help for this task.

RewriteEngine on 
RewriteBase    /
RewriteRule ^localhost/([^/]*)/([^/]*)/([^/]*)$    localhost/$1/$2.php?id=$3