Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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?

share|improve this question
    
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 :) –  Sam Saffron Jun 1 '12 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. –  Kevin Vermeer Jun 1 '12 at 12:33
    
appreciated, but the feature is not quite ready yet, that is why that tab is hidden from the UI –  Sam Saffron Jun 1 '12 at 13:39
    
@SamSaffron - So that's why all the buttons produce an alert that says dev only not implemented yet? :) –  Kevin Vermeer Jun 1 '12 at 14:07
add comment

3 Answers

up vote 1 down vote accepted

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.

share|improve this answer
add comment

Note: You'll get a better answer to this by emailing team@stackoverflow.com, 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 rediret to HOME PAGE or 404 not found?").

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

share|improve this answer
    
I'd probably report this to meta.stackoverflow.com/questions/tagged/link-validator+bug and keep this discussion public so everyone can benefit (as I said, a 302 seems to be industry standard practice) rather than emailing, but thanks for the advice. –  Kevin Vermeer May 30 '12 at 17:29
    
@KevinVermeer Indeed, I already did. –  toomanyairmiles May 30 '12 at 17:49
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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