开发者

Implementing Google Crawlable AJAX URL's with Mod Rewrite

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 w开发者_开发技巧ould 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


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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜