Answer the question
In order to leave comments, you need to log in
How to make a mass redirect to the 2nd level of nesting?
Hello! Please help:
Is it possible to somehow make a mass redirect to the 2nd level of nesting? On MODX they made url nesting up to the 2nd level (no subcategories). But the pages before that were indexed with the full url, so when you go to them, we get 404.
You need to do the following:
from site.ru/catalog/subcatalog/product redirect to site.ru/product
The problem is that nesting can be different. And a lot of pages.
Somehow via htaccess or maybe a plugin?
Answer the question
In order to leave comments, you need to log in
RewriteCond %{REQUEST_URI} ^/catalog/subcatalog/(.+)$
# если строка начинается с /catalog/subcatalog/product/
RewriteRule ^(.*)$ /%1 [R=301,L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question