B
B
bossigorxxx2022-03-15 22:56:51
htaccess
bossigorxxx, 2022-03-15 22:56:51

How to redirect such pages?

Hello. I broke my head how to redirect such pages:
https://site.ru/?page_id=430 https://site.ru/proekty/olimpiada-uchiteley-matematiki/
https://site.ru/?page_id=710 https: //site.ru/proekty/podderzhka-matematikov-ic...

If I set it like that, it immediately redirects to the main page. But if there is only one page, then everything works out

RewriteEngine on
RewriteCond %{QUERY_STRING} ^page_id\=430$
RewriteRule ^$ https://site.ru/proekty/olimpiada-uchiteley-matematiki/? [R=301,L]

RewriteCond %{QUERY_STRING} ^page_id\=710$
RewriteRule ^$ https://site.ru/proekty/podderzhka-matematikov-i-chlenov-ih-semey/? [R=301,L]


I will say right away that there are a lot of pages

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2022-03-16
@bossigorxxx

hold friend

RewriteCond %{QUERY_STRING} (?:^|&)page_id\=430(?:$|&)
RewriteRule ^$ /proekty/olimpiada\-uchiteley\-matematiki/? [L,R=301]

And here's to you so that your soul rejoices
https://donatstudios.com/RewriteRule_Generator

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question