htaccess:当条件成立时自动重定向到新的URL

I am using htaccess rule on my website for example see the below rule:

RewriteRule ^(en|ar)/properties/$ search.php?lang=$1

this rule is working fine as the user visit http://domain.com/en/properties/

when user visit http://domain.com/search.php?lang=ar the htaccess automatically redirect it to the first link

is that possible? Any help in this regard is appreciated.

thanks

Here is an Example what you are looking for

RewriteEngine on
# remove trailing slash
RewriteRule (.+)/$ /~account/$1 [L,R=301]

# add trailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .*[^/]$ /~account/$1/ [L,R=301]

# perform redirect if indiana.edu
RewriteCond %{HTTP_HOST} ^www.indiana.edu$ [NC]
RewriteRule ^(.*)$ http://www.iu.edu/~account/$1 [R=301,L]

Or

# Permanent URL redirect -
Redirect 301 /search.php?lang=ar http://domain.com/en/properties/

Please try this:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(en|ar)\/properties\/$ search.php?lang=$1