Skip to content

Instantly share code, notes, and snippets.

@ialexop
Created March 7, 2016 06:59
Show Gist options
  • Save ialexop/594f6f8683efa3a0075b to your computer and use it in GitHub Desktop.
Save ialexop/594f6f8683efa3a0075b to your computer and use it in GitHub Desktop.
# Set the root path (that's our variable not Nginx variable) to the landing page template file
set $rootPath "/map.php";
set $crawlerPath "/map.html";
if ($http_user_agent ~ "Ask Jeeves/Teoma|AdsBot-Google|exabot|Mediapartners-Google|GoogleToolbar|Google Web Preview|googlebot|yahoo|bingbot|baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|msnbot|embedly|quora link preview|showyoubot|outbrain|pinterest|slackbot|vkShare|W3C_Validator|WebCrawler|Screaming Frog SEO Spider|Slackbot-LinkExpanding|robot|crawler") {
set $isCrawler 1;
rewrite ^ $crawlerPath;
}
if ($isCrawler = 0) {
rewrite ^ $rootPath;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment