how to route by anchor?

hi,all!
I'm new to here.I have a problem about routing anchor or redirect url
by anchors,for example:
I want to request a url like "www.myhost.com/foo#bar" and then
response a new url like "www.myhost.com/foo/bar". My problem is I
don't know how to read the anchor from a request.
Any thought? thanks in advance :slight_smile:

Unfortunately, you can't. Anchors are not passed to the server in the
request. The only way to do anything with them is to read them on the
client side with JavaScript, and pass information about them to the
server.

See this article for an example of how they're used to maintain
browser history:

http://dev.aol.com/ajax-handling-bookmarks-and-back-button

thanks for your answer, now I got it.