5

I'm setting up redirection for mobile/non-mobile pages. User agent is detected and redirected appropriately, but the ?mobile=1 or ?mobile=0 flag can be used to force a switch. When that flag is used, I always do a 301 redirect because the ?mobile= links should not be indexed, just their targets. Is this a correct assumption?

Additionally, there is the case of redirection by trying to visit the mobile link /m with a non-mobile user agent and vice versa. In this case I want to do a 301 redirect as well (mostly because it makes the code simpler), but I think it also makes sense to me semantically; the target URL for your user agent is the correct one.

A coworker is insisting that /m visits by a non-mobile user agent should do a 302 redirect because the /m link is valid. However, the only way to make it valid is to either visit ?mobile=1 at the same time (which would already do a 301 redirect to /m) or to have something else on our website that sets the session to mobile, which is something we either rarely or never do.

Google's documentation seems to indicate that it actually doesn't matter if you use 302 or 301 for mobile/non-mobile redirection (at least if you have the Vary: User-Agent header and/or rel="alternate" link specification; we currently have neither, though).

My arguments for the 301 are:

  • Simplifies the code a bit
  • Non-mobile spiders will not index the /m link, so theoretically it should not show up for search results which spares non-mobile users an additional redirect when they visit the link (similar situation for mobile spiders/users)

However, he does have a point about both of the URLs being valid. Which status code would be better to use in this case?

7
  • Any reason why your not considering the SEO purposes of responsive designs? Commented Mar 21, 2013 at 23:57
  • @bybe you mean not redirect at all? Commented Mar 22, 2013 at 0:09
  • 1
    @bybe How do you know he hasn't considered responsive design?
    – GDVS
    Commented Mar 24, 2013 at 16:45
  • @Gdav It's a open question to open up a conversation if the questioner has or not considered responsive design. We won't know if we dont ask... Commented Mar 24, 2013 at 16:50
  • 1
    @bybe Your question presupposes that the OP isn't considering responsive. Read it. You also imply – falsely - that non-responsive approaches are invalid from an SEO standpoint. In any case, why presume to question somebody's chosen approach unless invited to do so? He may have very good reasons for not using responsive.
    – GDVS
    Commented Mar 24, 2013 at 17:03

1 Answer 1

4

It sounds like you've answered your own question. As per Google's documentation, the redirection method doesn't matter, though I must say I too would lean towards using 302 – as your colleague says, both URLs are valid and using 302 is common in other conditional redirect scenarios.

However doing either without using Google's recommended Vary and rel="alternate" (desktop referencing mobile) and rel="canonical" (mobile referencing desktop) seems prone to problems. I'd strongly recommend implementing these.

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.