M
M
Magnet192019-08-10 23:49:12
htaccess
Magnet19, 2019-08-10 23:49:12

How to 301 redirect product card to catalog section in htaccess?

There is a catalog, there are sections in it, in the products sections, there are pages with a product card, from which you need to redirect to the catalog section.
The path of the product card is - /catalog/(some section)/(find the product)/
You need to make a 301 redirect to - /catalog/(some section)/
How to redirect from the product card of any section to the section of this product?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
dodo512, 2019-08-10
@Magnet19

RedirectMatch 301 ^(/catalog/[^/]+/)[^/]+/$ $1
Or

RewriteEngine on
RewriteRule ^(catalog/[^/]+/)[^/]+/$ /$1 [R=301,L]

S
Saboteur, 2017-12-26
@dmc1989

.IF does not compare strings. You need to write your own function to compare strings byte by byte.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question