I have a landing page that redirects if the http referer is from a known site using a simple nginx rule:

location = /index.html {
  if ($http_referer ~* (www.)?amazon.com) {
    return 302 https://mydomain.com/amazon.html;

Should the redirect use a 301 (permanent) or 302 (temporary)? I'm thinking 302, since this is a marketing tactic. What is the best for SEO?


1 Answer 1


302 redirects should be used if they are temporary only - it basically serves as an instruction to "recrawl this later", as far as my understanding goes. So if the redirect will be permanently in place, 301 is the way to go.

However given you're testing a referrer, when Google crawls the site they won't know about the redirect at all, so I'm not sure what bearing you'll see this having on your SEO.

  • Agree about no bearing on SEO, but just want to do what is best for browser clients.
    – Justin
    Jun 5, 2014 at 23:25
  • 301 is best, that way they'll cache the redirect, and save you a request. Not super expensive, but if it's permanent you may as well. If you'll only have the redirect in place for a short time, 302 will help to prevent the caching.
    – LuckySpoon
    Jun 5, 2014 at 23:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.