Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using 301/303/307 redirects for dynamic short urls

We're implementing a short url service where the redirection target will be changing daily. The urls will be accessed by mobile devices and will always be GET requests. I'm trying to understand which is the best 300-type redirect for the job.

AFAIK most url shortening services use 301 redirects (Moved permanently). However, according to the specs, the 303 (See other) and 307 (Moved temporarily) redirects seems like they were designed for our case...

  • Are 303/307 as well supported as 301? The specs say they were only implemented in HTTP 1.1- what limitations does that spell?
  • Are there any actual caching or performance implications of choosing 301 vs 303/307.
  • For GET requests, is there any reason to pick 303 vs 307?
  • Is there any reason to use 302 redirects?
  • Any other things to consider?
like image 520
Yarin Avatar asked Jan 26 '12 00:01

Yarin


People also ask

Does a 307 redirect affect SEO?

307 Redirect URL This redirect URL code method is used to make sure the HTTP request doesn't change when the server responds with a redirect. A 307 redirect code has no big impact on SEO. Instead of using 307 redirects, it's best practice to use a 302 redirect code instead.

What is the difference between 301 302 and 307 redirect?

302s are often used to create temporary redirects, but, with the advent of HTTP 1.1, 307 has replaced it as a valid temporary redirect. While a 302 is a little vague, a 307 states precisely that the requested URL has been moved to a temporary location and will be back in a while.

What is the difference between 301 and 307?

HTTP 307 Redirects and SEOThe 'link-juice' from the original URL is not passed on to the new URL. This is in contrast to 301 Moved Permanently redirects, wherein search engines update their index to include the new URL and pass on the 'link-juice' from the original URL to the new URL.

Will 301 redirects hurt SEO?

This means that 301 redirects do not harm SEO performance or reduce the “PageRank” metrics associate with a page URL – though they are not crucial to search rankings either. All 300-level server-side redirects pass PageRank to the destination page (including 301 redirects as well as 302s, and 307s).


1 Answers

Are 303/307 as well supported as 301? The specs say they were only implemented in HTTP 1.1- what limitations does that spell?

Yes/None.

Are there any actual caching or performance implications of choosing 301 vs 303/307.

I don't think so.

For GET requests, is there any reason to pick 303 vs 307?

303 has semantics different than 307. If the requested resource is "somewhere else", 303 is not the right answer.

Is there any reason to use 302 redirects?

Not really, as far as I can tell. It has the same semantics as 307, but the UA might rewrite a POST request to GET.

Any other things to consider?

See http://greenbytes.de/tech/webdav/draft-ietf-httpbis-p2-semantics-18.html#status.3xx

like image 58
Julian Reschke Avatar answered Sep 22 '22 01:09

Julian Reschke