Q:

GeoIP: Redirect all but specific countries

I am using Apache's GeoIP module and a MaxMind database to determine the country of a visitor based on their IP address and redirecting them to a country sub-folder as shown below:
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^US$
RewriteRule ^(.*)$ https://example.com/us$1 [L]

I would like to redirect all countries to the /us sub-folder except China and Russia. A list of country codes are listed here, but I'll prefer to apply a wildcard to the rewrite condition as opposed to listing every country in my .htaccess file. 
Is it possible to do something like RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^*$? Or do I have to expand the rewrite condition with all countries like RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(US|CA|ZA|NG|GH|)$?

A:

You could simply use negation ! to redirect anything but China CN and Russia RU.
RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} !^(CN|RU)$
RewriteRule ^(.*)$ https://example.com/us/$1 [L]

