Our wordpress site utilizes the wordpress cms to serve up json data that we ingest via ajax requests and serve up with javascript. I would like to create URLs for my regular wordpress pages/posts that follow google's recommended crawlable ?_escaped_fragment_= URL permalink structure:

For more information on crawlable ajax, read this article.

This article also goes into detail about making your ajax-driven site google friendly

So, while the javascript driven content's link looks like this:

http:// examplesite.com/#!about

The regular post generated from wordpress should have a URL like this:

http:// samplesite.com/?_escaped_fragment_=about

I am wondering if there is any way to do this with all wordpress posts/pages through the wordpress system. One alternative, using a 302 redirect from the htaccess file back to the wordpress generated posts/pages, which I haven't confirmed is acceptable by google can be found here

Still, since we are using wordpress as a CMS, it seems like it would be easy to use Wordpress engine (or a plugin) to serve up these alternate URLs, especially since it is becoming the standard method of having your javascript driven site's content indexable. I tried to modify the permalinks with this URL structure, but that was a no-go and did not work.

Any and all suggestions welcome!

  • Hash bang breaking the web one link at a time! Have you considered using PJAX github.com/defunkt/jquery-pjax which is pushState and ajax together. Clean urls without the hash, without the bang. – Adam May 15 '12 at 15:16

I would suggest not using the hash bang urls. Consider PJAX: https://github.com/defunkt/jquery-pjax

It does partial page loads to speed things up and gracefully degrades for users with JavaScript disabled and search bots.

There is even a little library for making using PJAX in themes a bit easier (example).

  • I guess the concern is, will this index the non-fancy pages, and force us to use a redirect for each wordpress built page, which forces search engines to throw up a red flag? – Starfs May 15 '12 at 15:58
  • what do you mean by "non-fancy" pages? PJAX works by causing partial page loads -- if someone visits without javascripts all the links just work like normal. So everything should get indexed. – chrisguitarguy May 15 '12 at 16:07
  • 1
    @Starfs PJAX (as I also suggested above) writes clean URLs. It operates in the same fashiion as any AJAX request would, retrieving content without a page refresh, except there's no use of #! and you get clean URLs to /your-post all of /the-time so the SEs will see clean URLs and index those accordingly. Also ?_escaped_fragment_=about is not generated by WP, its requested by Google. Thus if you want to use the hash-bang then you need to map a rewrite rule that takes any request for ?_escaped_fragment_ to its normal equivalent i.e. the location of the remote-content. PJAX avoids that. – Adam May 15 '12 at 16:40
  • @Christopher and @ userabuser ok, Im trying to wrap my head around the PJAX method of doing this. My assignment was to do the escaped_fragment method because that is what google recommends, so I'd still like to know if wordpress can dynamically generate this type of permalink (ideally to avoid a 301 or a 302 -because there is so much conflicting information about all of this out there) – Starfs May 15 '12 at 17:49
  • also, if using PJAX, can we also use the hash-bang? – Starfs May 15 '12 at 17:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.