G
G
gehede2016-09-12 18:05:27
Regular Expressions
gehede, 2016-09-12 18:05:27

Are the words contained in the regular expression?

Good afternoon,
I'm trying to make a check for the url, whether the word exists in it or not.
http://site.ru/{msk|spb|region}/page
That is, the url should be site.ru, and between the curly braces something can be, but something is not.
It turns out such a url site.ru/page
And such site.ru/msk/page
Must be valid
I try like this:
/site.ru\/(?:^(?!msk|spb\/).*$)page/i
What - something nifiga, already tortured ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Sisyukin, 2016-09-12
@Caarl

regular season
it is not entirely clear what you are doing. if you just check the line or make htaccess

RewriteCond %{REQUEST_URI}  ^(\/)*(msk|spb|region)*\/page
RewriteRule ^(.*)$ /go to? [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question