Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

253
Views
htaccess: redirect article one level deeper without loop

I have a url like this:

https://example.com/product/my-product-name

I need to redirect to:

https://example.com/product/item/my-product-name

I tried multiple solutions, also solutions I've found here on SO, but I ended up on infinite loops when I accessed /product (which shall NOT redirect) and also multiple redirects when I called the "old" product.

So: https://example.com/product/item/my-product-name

shall NOT redirect.

https://example.com/product/my-product-name shall redirect to https://example.com/product/item/my-product-name

and

https://example.com/product/ and https://example.com/product shall NOT redirect.

Can anybody help me on this? Thanks!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You may use this redirect rule your topmost rule in site root .htaccess:

RewriteEngine On

RewriteRule ^(product)/(?!item/)(.+)$ /$1/item/$2 [L,NE,R=301]

Make sure to clear your browser cache before testing this change.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!