1

A while ago, sparkfun.com changed their URL structure from

/commerce/product_info.php?products_id=9266

to

/products/9266

This is nice, right? We don't need to know that it is (or was) a PHP page, and commerce, product_info, and products_id all tell us that we're looking at some products. The latter form seems like a great improvement.

However, the change would have broken existing links. So, nicely, they stuck in 302 redirects. Visit http://www.sparkfun.com/commerce/product_info.php?products_id=9266 and your browser will issue

GET /commerce/product_info.php?products_id=9266 HTTP/1.1

to which Sparkfun's servers reply

HTTP/1.1 302 Found
Location: http://www.sparkfun.com/products/9266

This 302 redirect is caught by Stack Exchange's link validator as a broken link. It's not broken it works just fine. Here, try it: http://www.sparkfun.com/commerce/product_info.php?products_id=9266

I understand that a 302 redirect is intended to be a temporary redirect, while a 301 should be used for permanent changes per RFC 2616. That said, Wikipedia and common practice use it as a redirect.

Who is in error in this situation? Is this an error in Sparkfun's redirect implementation or in Stack Exchange's URL validator?

4
  • How are you determining that we detected the URL as broken? A non-linked page on the site that still needs to be updated before it is announced perhaps :) Commented Jun 1, 2012 at 7:08
  • @SamSaffron - I'm making the determination by visiting /review/broken-links. When I clicked the /review button (we don't have much to review, so the rest of the tabs were empty), the site brought me to that page. Just trying to figure this stuff out so it's better when it is announced. Commented Jun 1, 2012 at 12:33
  • appreciated, but the feature is not quite ready yet, that is why that tab is hidden from the UI Commented Jun 1, 2012 at 13:39
  • @SamSaffron - So that's why all the buttons produce an alert that says dev only not implemented yet? :) Commented Jun 1, 2012 at 14:07

3 Answers 3

2

However, the change would have broken existing links. So, nicely, they stuck in 302 redirects.

Well, the important bit here is that the change would have broken existing links. /commerce/product_info.php?products_id=9266 isn't the location of the product page anymore, /products/9266 is. It's not at all unreasonable to expect the old-style links to stop working at some point - better to fix them now, while the site is happy to tell us what the proper location is, than later on when it isn't.

And yes, this makes more sense for a 301 than a 302, but 302 is widely used (as in the case of your sparkfun example) for the same purpose.

1

Note: You'll get a better answer to this by emailing [email protected], they handle questions and issues with the validator.

IMHO sparkfun have done the wrong thing SEO wise by using a 302, it should be a 301 (see "SEO: ecommerce item deleted by user, 301 redirect to HOME PAGE or 404 not found?").

At a complete guess perhaps the stack bot regards a 302 as broken, correctly in my view.

2
0

That said, Wikipedia and common practice use it as a redirect.

It is a redirect, but as you already know, 302 is a temporary redirect while 301 is a permanent redirect. Therefore, 301 is the only correct response header for your situation.

However, the issue here is that there is a link to a URL that redirects elsewhere. For almost all purposes this is a waste of resources as it adds an unnecessary delay to loading the required page. It adds an HTTP request, plus if the redirect went do a different domain name this would add an extra DNS lookup.

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.