S
S
Sergey Rewon2019-04-03 22:18:57
htaccess
Sergey Rewon, 2019-04-03 22:18:57

How to make 301 redirect in .htaccess (opencart 2.3)?

Changed the url in the online store (on opencart 2.3).
It was site.ru/tovar_new/product_1
It became site.ru/product-new/product-1
In general, I replaced the underscore with a dash.
How to make 301 redirect in .htaccess?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
wisgest, 2019-04-04
@wisgest

RedirectMatch 301 (.*)_(.*)_(.*)_(.*) $1-$2-$3-$4
RedirectMatch 301 (.*)_(.*)_(.*)      $1-$2-$3
RedirectMatch 301 (.*)_(.*)           $1-$2

It is enough to limit ourselves to one last rule: in this case, as many redirects as there are "_" in the path will be filled (for each redirect, the last found occurrence will be corrected).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question