1

I'm trying implement google ajax crawlable snapshots.

For this I've added following rewrite conditions in .htaccess as follows

RewriteCond %{QUERY_STRING} ^_escaped_fragment_=/?(.*)$
RewriteRule ^(.*)$ /snapshots/%1.html? [NC,L]

It works fine but it fails in following situation.

www.mysite.com/#!/

This is crawled as www.mysite.com/?_escaped_fragment_=/ as in the google documents.

I have a prepared index.html in my snapshots directory to serve such requests

But for the above rewrite condition it is searching for .html and that results 403 response. Appreciate if you can help me to fix to serve index.html page for such requests

Gihan
  • 4,163
  • 6
  • 31
  • 49

1 Answers1

1

You will need an additional rule for above use case. Insert this rule above your existing rule:

RewriteCond %{QUERY_STRING} ^_escaped_fragment_=/$ [NC]
RewriteRule ^ /snapshots/index.html? [NC,L]

RewriteCond %{QUERY_STRING} ^_escaped_fragment_=/?(.+)$ [NC]
RewriteRule ^ /snapshots/%1.html? [NC,L]
anubhava
  • 761,203
  • 64
  • 569
  • 643