A
A
Artem2019-06-13 19:30:22
htaccess
Artem, 2019-06-13 19:30:22

How to set up a redirect via RewriteRule for urls with a question mark?

Good afternoon.
It was required to make a redirect of the form: https://site.ru/catalog/product.html?brand= 31 --> https://site.ru/catalog/product.html?brand= wilo
I solved it using .htaccess:

RewriteCond %{QUERY_STRING} ^brand=31
RewriteRule (.*) https://site.ru/catalog/tovar.html?brand=wilo [L,R=301]

But for the following pages, like https://site.ru/catalog/ tovar2 .html?brand=31 --> https://site.ru/catalog/ tovar2 .html?brand=wilo, this rule no longer works, there is a redirect to https://site.ru/catalog/product.html?brand=wilo.
Help solve the problem.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
dodo512, 2019-06-14
@dodo512

RewriteCond %{QUERY_STRING} ^brand=31
RewriteRule (.*) https://site.ru/$1?brand=wilo [L,R=301]

R
Ricchie, 2017-07-27
@artemieknich

The correct relinking is on doctu.ru, as it is more convenient for users, and this is the main factor that a webmaster should worry about. This is where behavioral factors play a more important role than passing weight to other pages. The user will walk around the site for a long time, bringing pluses to karma.

A
Artem Sergeev, 2017-07-26
@VKSITE

Good afternoon. The question of linking is very complicated, for which task do you want to work with linking?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question