Why does Twitter use a hash and exclamation mark in URLs, and how do they rewrite search URLs? Why does Twitter use a hash and exclamation mark in URLs, and how do they rewrite search URLs? ajax ajax

Why does Twitter use a hash and exclamation mark in URLs, and how do they rewrite search URLs?


It's become the de facto standard that Google has established to ensure consistency and make ajax urls crawlable.

See http://code.google.com/web/ajaxcrawling/docs/getting-started.html

I believe they are using history.pushState. You can do history.back() in the console and it'll lead you back to the page.


Yes, it redirects with HTTP 302.

By the way, "!" is used to eliminate the case with an empty hash. "http://url#" will make a browser to slide to the top.


To answer the second part then: It is redirecting you to /#!/search.

If you look at the response headers when going to http://twitter.com/britishdev (plug plug) you are returned a 302 (temporary redirect) with the Location header set as "Location: http://twitter.com/#!/britishdev"

Yes JavaScript is then pulling all your detail in on the destination page but regardless that is where you are redirected to.