S
S
Sergey2015-09-21 15:16:16
PHP
Sergey, 2015-09-21 15:16:16

How to check a string for the absence of a number of letters in RewriteCond (regular expressions, htaccess)?

There is a RewriteCond %{REQUEST_URI} condition. In the requested string (domain.com /ru/apartment/228 ), we need to check for the presence of "/ru/" at the beginning (domain.com /apartment/228 ) and if it is not there, then we use RewriteRule... Tried with !ru and all sorts of nonsense like !^[^\/en\/]

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly Inchin ☢, 2015-09-21
@In4in

^(?!ru)

S
ShamblerR, 2015-09-21
@ShamblerR

RewriteCond %{REQUEST_URI} !^.*\.ru$
But if you also need this option
RewriteCond %{REQUEST_URI} !^.*\.(ru\|ru\/)$

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question