O
O
Oleg2021-04-07 23:29:18
htaccess
Oleg, 2021-04-07 23:29:18

How to redirect 301 using htaccess from site.ru/category/?page-3= to site.ru/category/page-3?

Hello.
Please tell me how to make a redirect using htaccess
There is a url: site.ru/category/?page-3= or site.ru/category/?page-3 It is
necessary to redirect from this url to site.ru/category/page- 3
That is, remove the question mark and = at the end. The page can be any, not only 3

An attempt was made to do: RewriteRule (.*)/?page-([\d]+)$ $1/page-$2 [L,R=301]

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2021-04-07
@bysobi

At the beginning of .htaccess add

RewriteCond %{QUERY_STRING} (?:^|&)(page-\d+)
RewriteRule ^category/$  https://site.ru/$0%1? [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question