Reputation: 5509
I am working on an eCommerce site that passes product ids in the query string. I just had to fix an issue where the product page didn't check the status of the product (live or archived) so if the user had a direct link e.g. a search result, the product would still display even if it had a status of "Archived".
My simple fix was to Response.Redirect("~/Products/Default.aspx");
if the status was not "Live".
Should I use RedirectPermanent
in this situation even if it is possible the product may come back online?
Upvotes: 3
Views: 1134
Reputation: 108790
IMO neither. You should display a page with the name of the product, and a message that it's no longer available. Redirect-on-error is very annoying behavior and should be avoided.
You might also want to mark the document so it doesn't get indexed by search machines. Something like:
<META NAME="ROBOTS" CONTENT="NOINDEX">
Upvotes: 3
Reputation: 56456
I found that as a general rule, I only do 301 redirects whenever an actual resource/page has moved, for example when reorganizing content on a web site.
It's almost impossible to correct a 301 made by error - browsers tend to remember 301 redirects, therefore an url which is permanently redirected cannot be used again.
In your particular case, maybe a product was archived by mistake? All the visitors who visited the product's page and got 301 redirected won't be able to see the product's page, even if the product gets un-archived.
As to search engines, you may display a different content for archived products, and you may want to appear it differently in your sitemap.xml
(different priority, or not at all), or you may exclude it from being indexed (robots.txt
or by using a robots meta).
Upvotes: 4