You seem to be wanting to do something like what facebook does, yes?
Well, then, you need to think about what is done in ajax on the browser, and what is done on the server, and what the browser sends to the server. Specifically, you should be aware of this:
The browser never sends to the server anything after the #
sign.
Therefore, if the url is http://mysite.com/foo/bar#!/baz
, all the broser sends to the server is http://mysite.com/foo/bar
. So your question, which is about server-side processing, doesn't really make sense because the web application on the server side doesn't see that.
What you need is some browser-side javascript to take a url that ends in #!
and make an XMLHttpRequest
to the server for something like http://mysite.com/content_js/bar
, which could then return the inner piece of content, without all your headers, footers, and sidebars, wrapped in some sort of json object. The browser-side javascript could then render that content.