N
N
Nikita Rubinkovskiy2018-07-16 22:27:59
htaccess
Nikita Rubinkovskiy, 2018-07-16 22:27:59

How to make a correct redirect?

Hello.
There was a need to remove duplicate pages in categories and subcategories of the site as follows:
RewriteCond %{QUERY_STRING} ^(.*)&?page=1$
RewriteRule ^(.*)/?$ /$1?%1%2 [R=301, L]
But another problem appeared: if you use the site search, then when you go from any page displayed in the search results to the first one, the search query is encoded, for example:
https://example.ru/search?query=%25D1%2581 %25D1%25...
It's a redirect, but how can I change it to fix the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2018-07-17
@avatar22007

Add NE Flag

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question