Redirect to custom landing pages based on http referer

justink101 nginx-forum at
Thu Jun 5 07:15:26 UTC 2014

Is it possible using nginx to essentially look at the http referer header,
and if its set to a specific value, and the page is index.html or /,
redirect to a custom landing page.

For example:

# Psuedo code
if($page = "index.html" and $http_referer ~* (www\.)?*) {
     rewrite ^ "our-amazon-landing-page.html" permanent;

Posted at Nginx Forum:,250656,250656#msg-250656

More information about the nginx mailing list