A
A
Alexey selftrips.ru2017-09-15 07:12:05
Regular Expressions
Alexey selftrips.ru, 2017-09-15 07:12:05

How to complement the regular expression so that it does not work in the presence of the exact word?

There is a redirect
RewriteRule (.*)\/([0-9]+)$ $1 [R=301,L]
How to make the view addresses
/какой то номер на конце
redirect (this is implemented in the line above)
But if the view address at the end
/page/какой то номер
is not
redirected?
Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Varlamov, 2018-03-26
@bes_internal

It is necessary to use negative lookahead in the regular expression:
RewriteRule (.*)(?!page/)\/([0-9]+)$ $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