Enabling Google’s AJAX Crawling Convention on NGINX

Google has a spec for making AJAX applications crawlable via the “#!” notation in the URLs.  One way to prepare your app for this is to perform the required conversions on the web server rewrite level.  

To do that in nginx, put this in the server {} context of your config:

        if ($args ~ “_escaped_fragment_=(.+)”) {

                set $real_url $1;

                rewrite ^ $real_url;


Rewriting to just $1 does not work, so this temporary variable is needed.

  1. ryanb reblogged this from fascinated
  2. fascinated posted this