我一直试图让GeoIP国家重定向工作。但是每当我编辑我的.htaccess文件时,它似乎都会破坏网站。
(仅供参考我使用云托管;不确定与正常共享托管的程序是否存在任何差异)
这是我的代码:
# MaxMind GeoIP Redirecting
GeoIPEnable On
GeoIPDBFile /applications/waterlinecooling/public_html/GeoIP/GeoIP.dat
# Start Redirecting countries
# Thailand
RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^TH$
RewriteRule ^(.*)$ https://www.waterlinecooling.com/$1 [L]
# Vietnam
RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^VN$
RewriteRule ^(.*)$ https://www.waterlinecooling.com/home-vi_vi/$1 [L]
# Indonesia
RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^ID$
RewriteRule ^(.*)$ https://www.waterlinecooling.com/home-id_id/$1 [L]
# The Rest Of The World
RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^A1$
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^A2$
RewriteRule ^(.*)$ https://www.waterlinecooling.com/home-th_en/$1 [L]