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
}
Question
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;
}
Solution
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
}