S
S
sm1rnv2018-05-05 11:34:07
htaccess
sm1rnv, 2018-05-05 11:34:07

Regular expressions. 301 redirect, how to do it right?

Good afternoon, colleagues!
Tell me how to correctly set up a 301 redirect for a range of pages:
from https://site.ru/program/advertising-messages/291908 to 1025224
to https://site.ru/events/advertising-messages/
I.e. pages:
https://site.ru/program/advertising-messages/291908
https://site.ru/program/advertising-messages/291909
https://site.ru/program/advertising-messages/291910
and so on. up to 1025224 should be redirected to https://site.ru/events/advertising-messages/

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2018-05-05
@shambler81

RewriteCond %{REQUEST_URI} ([0-9]{1,}) [NC] 
# в урле содержатся цифры от 0  не менее 1 
RewriteCond %1 >99
RewriteCond %1 <120
RewriteRule ^(.*)$ %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