Which redirect code to use for resolve resource?

Which redirect code to use for resolve resource? - 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 Which redirect code to use for resolve resource? error on your web browser. Problem :


On my website i have a list of items, each item has a link, the link has one parameter named "ID":



<a href="go?id=2">item</a>


When i generate the list i don't know the exact url to the item, for example it could be too expensive (lots of queries to all kind of resources) to figure out.



When to user clicks the link "go?id=2" the server figures out the exact url and sends the user to that url with a redirect code 301. This will always be the same url.



I was wondering if i'm using the correct http code for my case? Mainly because while doing research i discovered more redirect codes than the usual 301 and 302.


Solution :

To answer your specific query, if this needs to be a redirect, then a 301 (permanent) is the correct one. It is always a GET request and it is permanent. The client will likely cache the 301 redirect, so will not query your site the next time.



However, as @Stephen mentioned in comments, you should ideally link to the target URL if at all possible.



At least cache the result of id=2 so that you can use the actual URL when the list of items is next generated. Or pre-compute these in the background at some point?


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

Comments

Popular posts from this blog

How do I redirect traffic only if being accessed from a specific port?

DNS entry to redirect constant url to changing directory name

How to redirect to any domain [duplicate]