I have been using this code to redirect visitors from a number of countries to domain#2 (using GeoIP), which works fine:

RewriteCond %{HTTP_HOST} !^domain\.two$ [NC]
RewriteRule ^(.*)$ http://domain.two/$1 [L]

Now I would like to redirect all countries not listed above to be redirected to domain.one. How could I archive this?

1 Answer 1


I found the solution:

RewriteCond %{HTTP_HOST} !^domain\.one$ [NC]
RewriteRule ^(.*)$ http://domain.one/$1 [L]

The humble "!" is the key. It makes the condition work for all countries not in the list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.