1

We have a situation where we need to set a cookie on a user's session. In order to do this we currently have a series of redirects in place:

Initial request > 30x to get the cookie > 30xset the cookie > 30x to return the user to the original page requested.

These are all browser redirects and happen quickly enough, and only on the first "hit" so the user experience isn't negatively impacted. However I think there may be some concerns about the SEO ramifications of this process.

  • For this purpose does a 301 redirect make the most sense (vs a 302)?
  • Will having three consecutive redirects be detrimental to page rank?
  • Are there any best practices / hands on experience people have with this type of chained-redirect?
5
  • What happens if the client doesn't support cookies? Googlebot doesn't use cookies and they may not be able to crawl your site with that setup. Jan 18, 2019 at 17:16
  • 1
    Have you considered using JavaScript to set the cookie instead of redirecting? Or just setting the cookie on the initial page request? Why are redirects even needed? Jan 18, 2019 at 17:18
  • If the client doesn't support cookies the page will load but certain actions may not be available. These are related to auth and session persistence.
    – nhinshaw
    Jan 18, 2019 at 18:33
  • Unfortunately this is dealing with Django's sessionid cookie, which is http-only so it cannot be set via JavaScript.
    – nhinshaw
    Jan 18, 2019 at 18:35
  • 1
    This may be getting too specific, but how are you detecting cookies? With a redirect? If so, how do you avoid always redirecting clients (at least once) that don't support cookies (eg. Googlebot)? 3 redirects does seem excessive (not necessarily for SEO) but for whatever task it is you are doing... why do you need a 30x redirect to "get the cookie", before you "set the cookie" (with another redirect?). I'm wondering why you think a 301 might make "the most sense" here? It doesn't sound "permanent" to me as it is only intended to catch the users "first hit". (?)
    – MrWhite
    Jan 19, 2019 at 1:53

2 Answers 2

1

If you can figure out how to do this setup without the redirects, that would definitely be better.

Keep in mind that you probably also have a redirect from http to https, so that's a total of up to 4 redirects to get the user where they want to go. If the user has high latency, that could be as long as several seconds before your page even begins to load.

As far as SEO, as long as your redirects still work without cookies then googlebot will follow them just like a web browser. However, Google factors page performance in to their rankings, so it stands to reason that a redirect setup that reduces performance could also ding a page's rank.

Are there any best practices / hands on experience people have with this type of chained-redirect?

It is possible (in fact quite likely) that this chained-redirect setup is a design standard that I haven't worked with or heard about. However, I personally would tend to strive for zero redirects on my pages as long as the request URL is correct.

1

You would want to keep to a minimum:

  • how long it takes for the page to load.

  • how many pages that is redirected through to get to the final page.

  • how many clicks away from the homepage the user must go through to get to the final page.

These all knock your SEO score down if there are more than 5 seconds of load, and 3 redirects or clicks through to the end page.

A term you will want to search for more information 'Page Crawl Depth more than 3 clicks'.

Your Answer

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

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