Need help in writing the rewrite rule | Community
Skip to main content
Level 2
March 7, 2025
Question

Need help in writing the rewrite rule

  • March 7, 2025
  • 2 replies
  • 654 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

PavanKu2Author
Level 2
March 7, 2025

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]
[/]
Asutosh_Jena_
Community Advisor
Community Advisor
March 7, 2025

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?

 

PavanKu2Author
Level 2
March 7, 2025

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

kautuk_sahni
Community Manager
Community Manager
April 11, 2025

@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