Should a link validator report 302 redirects as broken links?

Should a link validator report 302 redirects as broken links? - If a page has internal and external outgoing links to redirecting URLs, it’s returning 3xx (301, 302, etc.) HTTP status codes standing for redirection. This issue means that the page does not exist on a permanent or temporary basis. It appears on most of the popular web browsers, usually caused by a misconfigured website. However, there are some steps you can take to ensure the issue isn’t on your side. You can find more details about redirecting URLs by reading the Google Search Central overview. In this article, we’ll go over how you can fix the Should a link validator report 302 redirects as broken links? error on your web browser. Problem :


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?


Solution :


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.



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.




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.


We hope that this article has helped you resolve the redirects, url, 302-redirect error in your web browsers. Enjoy browsing the internet uninterrupted!

Comments

Popular posts from this blog

How to redirect to any domain [duplicate]

"302 found" for index page bad for SEO?

Create redirect from url like www.example.us/?p=100&option=