0

I would like to manually produce the _escaped_fragment_ query parameter for search bots \ crawlers that don't implement _escaped_fragment_ support on their own.

Using nginx, I tried to do the most obvious, yet it didn't work. Couldn't find any replication of this post anywhere.

Any help is much appreciated.

if ($http_user_agent ~* (LinkedInBot|UnwidFetchor|voyager)){
        rewrite ^(.*)$ ?_escaped_fragment=$1
        #Reverse proxy to phantom instance
        proxy_pass http://127.0.0.1:8888;
        break;
    }
Oleg Belousov
  • 9,981
  • 14
  • 72
  • 127

1 Answers1

1

I don't think you can do a rewrite with a leading ?, try pre-pending with index

if (foo) {
  rewrite ^ /index.php?_escaped_fragment=$1 last;
  #the remaining config
}
Mohammad AbuShady
  • 40,884
  • 11
  • 78
  • 89