And in Angular, you can (and almost certainly should) use $location for all of this URL mangling. See [the docs](http://docs.angularjs.org/api/ng.$location), it supports pulling out and setting the various pieces of the URL.