When creating a short url service, is 302 temporary redirect the best way to go?
Asked Answered
K

2

7

When creating a short URL service for URLs on the same domain, should we be using a 302 redirect?

Full URL structure: example.com/gig/{id}/gig-full-name-slug
Short URL structure: example.com/g/{base64id}

We're using asp.net mvc3, if there's any shortcuts.

Kidding answered 2/6, 2011 at 23:47 Comment(0)
U
7

Your best bet is to return a 301 so that search engines pick it up as a proper redirect and dont try to index your short urls. This is what the others do (ie. bit.ly)

Unicuspid answered 3/6, 2011 at 1:36 Comment(0)
F
3

As it's not a temporary redirect (as the content will never be back at that URL), a HTTP 303 See Other redirect would be more appropriate.

Foresheet answered 3/6, 2011 at 0:6 Comment(3)
I suspect that other short URL services are using HTTP 301 Moved Permanently. Probably because that response is cachable.Egide
@goalie looks like you're right. I'll probably roll with the 301. Cheers.Kidding
@Ben Cull: Well, a 301 doesn't really fit, but I suppose that you have to adapt to how others (mis)use the codes rather than what the standards say...Foresheet

© 2022 - 2024 — McMap. All rights reserved.