V
V
Vyacheslav Abramov2020-02-04 15:02:18
htaccess
Vyacheslav Abramov, 2020-02-04 15:02:18

How to make .htaccess redirect with removing part of url in one rule?

The question is the following: there
was a site with a complex structure, etc. we are transferring it to a new engine, but we decided not to bother with the catalog.

I wanted to transfer the url through htaccess, but ....
the task is to have old links like:

site.ru/catalog/auto/id-tovarka/
site.ru/auto/tovarka/


now the question is how to write this rule, but
BUT ....
but at the same time save the display
site.ru/catalog/auto/

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vyacheslav Abramov, 2020-02-04
@saltos

the question is removed, it is decided by the introduction of the rule:

RewriteRule (.*)/(.*)/id-(.*) https://site.ru/$2/$3? [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question