2

Our company website currently has 13 languages, of which Chinese is one. We have seen significant bounce rates from visitors in China (largely due to site speed there) and so we will be launching a standalone Chinese website that is hosted in mainland China in the coming days.

The new Chinese site features less functionality than our main site and highlights fewer products than our company offers - this is to aid our SEM/Weibo/Wechat campaigns in that market which only target specific products.

I don't want to redirect the Chinese language version of our website to the new Chinese site as 1) A Chinese speaking visitor is not necessarily currently within China 2) Our CDN doesn't include China meaning the new site will be a lot slower than our global site if you are outside of China 3) Our global site has seen years of MVT / AB testing.

Is it possible to redirect visitors from the Chinese language version of our site (this is in a subdirectory of our main site) to the new Chinese site ONLY if the visitor is located within China?

If possible, does this go against best practice?

To recap:

The Chinese website needs to be for visitors INSIDE China. The Chinese version of our global site is for Chinese speaking visitors OUTSIDE China.

1 Answer 1

2

Assuming you're running Apache, this can be achieved with the mod_geoip and mod_rewrite modules.

Once you have those installed properly and your URL structures will be the same on the Chinese and non-Chinese sites, you can achieve your desired result with code that will look something like

RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(CN|HK)$
RewriteRule ^(.*)$ http://www.mydomain.cn/$1 [L]

This will basically look at the visitors country code returned by the geo_ip module. In this case, if it's CN or HK (Hong Kong) it will redirect the user to the same path their requesting on the "main" server, only at the domain www.mydomain.cn the $1 at the end of that rule appends the current request to the new request.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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