Mobile app version of vmapp.org
Login or Join
Megan663

: Should a link validator report 302 redirects as broken links? A while ago, sparkfun.com changed their URL structure from /commerce/product_info.php?products_id=9266 to /products/9266 This is nice,

@Megan663

Posted in: #302Redirect #DeadLinks #Redirects #Url

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 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: 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: 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?

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Megan663

3 Comments

Sorted by latest first Latest Oldest Best

 

@Cofer257

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.

10% popularity Vote Up Vote Down


 

@Pope3001725

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.

10% popularity Vote Up Vote Down


 

@Caterina187

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 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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme