I have a web page with basicly the following URL structure:
www.example.com/main.php?userId=mattias.wolff
www.example.com/definitions.php?userId=mattias.wolff
www.example.com/tasks.php?userId=mattias.wolff
www.example.com/profile.php?userId=mattias.wolff
What I would like to do is to change this to get rid of the parameters:
www.example.com/mattias.wolff
www.example.com/mattias.wolff/definitions
www.example.com/mattias.wolff/tasks
www.example.com/mattias.wolff/profile
Server side this is not a problem since I can just use mod rewrite to rewrite the URLs to the "old" format (including paramters etc.)
My question is how this should be handled client side? The pages content is very much generated by JavaScript and I therefore need to get the parameters in the same way as before.
Is there some best practice that I have missed here? Writing a function on that parse the new URL in Javascript or send the "old" URL from server side in some kind of parameter?
#and?, then split at/. Consider writing down your scheme for yourself. Ifcomponent[0] = username, component[1] = pagesatisfies your needs, go with it.