Developer forum

Forum » CMS - Standard features » 301 redirect when products don't exist anymore

301 redirect when products don't exist anymore

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

I have a few scenarios where I need to create 301 redirects.

The first one is a scenario where the product detail was moved to a different page than the product list page. For example, the old URL for the detail page was http://somedomain/products/some-product and the new one is http://somedomain/products/details/some-product

In this situation, I need to redirect the old links to the new links. On the ProductCatalog module on Product page, I have set to return 404 for ProductDetail ( ) page hoping that this will send the link to the 404 handler and trigger the redirect from Direct paths. It does not seem to happen this way. I have unique domain names for each layer and the checkbox "this domain can only reach this website" is set to true.

The second situation is for products that don't exist anymore or had their link changed. Is somewhat similar to the situation above, except that I have not set the " " to TRUE. 

I cannot make any of the situations above work.

Can somebody tell me what I am doing wrong?

Tank you,
Adrian


Replies

 
Nicolai Pedersen
Reply

You are not doing anything wrong. It cannot be done like this.

The URL exists in DW and therefore it does not get handled by the 404 handler, but just responses a 404 status.

Best option is to add a bit of logic in the detail templates in these pages.

BR Nicolai

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Nicolai,

I was afraid of this :)

I have ended up with custom code in the template but I think we might need better support for this type of redirects as they might be pretty common.

We have used IIS rewrite in the past but that's not always easy to set.

Cannot suggest a solution though. I am sure you guys can think of something if it becomes a priority. Right now, I believe the problem is the way the system checks for the existence of the URL. Especially for Products because they are always displayed on the same page. As long as the catalog page is not changed, we'll never be able to use DirectPaths for redirect. If you can find a way to check the whole URL (including group and product) maybe we can use DirectPaths and avoid using custom code or IIS rewrite. 

Thank you,

Adrian

 

You must be logged in to post in the forum