Expand my Community achievements bar.

Join expert-led, customer-led sessions on Adobe Experience Manager Assets on August 20th at our Skill Exchange.

Need help in writing the rewrite rule

Avatar

Level 2

Hi All,

    can anyone please help me in writing the redirect rule for the category and subcategory which are giving 404, 500 and 301 status and these category and subcategory are dynamically generating.

For example :  https://www.innovations.com/de/products/mobiles/samsung.html

here : https://www.innovations.com - Domain

de - Language

products/mobiles - category

samsung - subcategory

 

 

And some times the page is giving 2002 status but not loading anything on the page means its blank page

 

Thanks,

Pavan

5 Replies

Avatar

Level 2

Hi Team,

      Please find the following Thymeleaf code snippet and please correct the me if I am wrong or not :

RewriteCond %{REQUEST_URI} ^/?([A-Za-z]{2})/[# th:text="${pcpname}" /]/([^/]*)\.html$
[# th:if="${REQUEST_STATUS == 404} or ${REQUEST_STATUS == 500} or ${REQUEST_STATUS == 301}"]
RewriteRule ^/?([A-Za-z]{2})/[# th:text="${pcpname}" /]/([^/]*)\.html$ /[# th:text="${pcpname}" /].html [PT]
[/]

Avatar

Community Advisor

Hi @PavanKu2 

Can you please provide some more clarity to the ask?

From where you want to redirect? What is the source and destination?

Also when you say sometime page gives 2002, are you using cloudflare cdn?

 

Avatar

Level 2

Hi @Asutosh_Jena_ ,

   When we go to the Products listing page there we will see the categories and onclicking of the categories we will see the subcategories and their corresponding products but the issue is for some of the categories it is giving 404 or 500 or 301. Is there any possibility to redirect to the product listing that too it has to be done dynamically.

Thanks,

Pavan

Avatar

Administrator

@PavanKu2 Did you find the suggestion helpful? Please let us know if you need more information. If a response worked, kindly mark it as correct for posterity; alternatively, if you found a solution yourself, we’d appreciate it if you could share it with the community. Thank you!



Kautuk Sahni

Avatar

Level 2

Hi @kautuk_sahni ,

   can you please help me regarding the issue. The issue is to write rewrite rules for the product catalog url formation using system rewrite template using thyme-leaf.

Thanks,

Pavan