M3Server Technical Blog FAQ country code redirect

country code redirect



This example illustrates how to redirect a directory or site to a different web site depending on your specific country codes using Apache’s htaccess.


RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(CN|TR|IN|ID|BR|JP|TH)$
RewriteRule ^(.*)$ https://your_site.net/some_directory [L]

Of course, replace the example domain above with your appropriate choice.