I was wondering how do they do that thing?

Just like when you signup at twitter, you get u a vanity url like

Does anyone know?

Pls if someone can explain :slight_smile:


Ya you require some bit of url tweaking and also the code tweaking

it is called mod_rewrite in apache servers edit .htaccess with corresponding url

How can server distinguish userPage query from comments query?


For multiple pages, do I have to write the code as:

RewriteEngine ON
RewriteRule ^.*/([^/\\.]+)/?$ userPage.php?page=$1 [L]
RewriteRule ^.*/([^/\\.]+)/?$ questions.php?page=$1 [L]
RewriteRule ^.*/([^/\\.]+)/?$ comments.php?page=$1 [L]

For multiple pages you can either rewrite on a page by page basis:

#user/name to user.php?user=name
RewriteRule ^user/(.*)$ user.php?user=$1 
#pron/type to pron.php?type=type
RewriteRule ^pron/(.*)$ pron.php?type=$1

or rewrite everything to a router:

#user/name to index.php?q=user/name 
RewriteRule ^(.*)$ index.php?q=$1