views:

39

answers:

1

I'm looking to implement the Google crawlable AJAX states as described here:

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

Essentially this requires specifying your AJAX states with a #!state value at the end of the url.

This should then be passed to the application server (PHP in my case) as part of the query string eg.

http://www.example.com/#!open would become http://www.example.com/?_escaped_fragment_=open

Unfortunately i'm having trouble figuring out how to implement this via mod_rewrite on Apache 2. Can anyone offer some help?

Cheers

James

+2  A: 

The RFC 2396 section 4 says:

When a URI reference is used to perform a retrieval action on the identified resource, the optional fragment identifier, separated from the URI by a crosshatch ("#") character, consists of additional reference information to be interpreted by the user agent after the retrieval action has been successfully completed. As such, it is not part of a URI, but is often used in conjunction with a URI.

That is, the fragment won't be visible for the web server so you'll have to look for some other method as mod_rewrite is a no go.

Depending on what language you are familiar with, you can install HTMLUnit if you're a Java dev or you could try to write a proxy and use it to fetch the parsed content by, i.e. Jaxer or a Firefox instance. I used Jaxer and is pretty easy to implement the crawlable ajax pages after you get used with the Jaxer API (which isn't complicated at all)

methode
Ah, my bad. I misinterpreted the docs. The state isn't meant to be used for normal browsers, it is transformed from `#!state` to `_escaped_fragment_=state` by Google's crawler.
WeeJames