Mobile app version of vmapp.org
Login or Join
Gretchen104

: Htaccess redirect based on country of origin Can a rule that filters and redirect traffic based on country of origin be implemented in .htaccess? Can it be implemented in any other way then

@Gretchen104

Posted in: #CountrySpecific #Htaccess #Redirects

Can a rule that filters and redirect traffic based on country of origin be implemented in .htaccess?

Can it be implemented in any other way then by an IP address? I need the solution to be as accurate as possible.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Gretchen104

2 Comments

Sorted by latest first Latest Oldest Best

 

@Fox8124981

Yes, we used to filter visitors from Nigeria by .htaccess:

RewriteEngine On

RewriteCond %{ENV:IP2LOCATION_COUNTRY_SHORT} ^NG$
RewriteRule ^(.*)$ www.google.com [L]


You can generate your own at ip2location.com/free/visitor-redirection .

10% popularity Vote Up Vote Down


 

@RJPawlick198

Maybe this link (how to redirect domain according to country IP address) can help you.

I think, however, that this is not a good practice.
Redirection by language or country is quite strict. It is better preferred:


A message at the top of your site that influence the visitor to go to
the page built with his language.
A system that can easily change the language (flags)


This is only my opinion.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme