GEOIP重定向特定国家交通到国家域名?国家、重定向、通到、域名

2023-09-02 00:46:54 作者:安染

我想全国流量重定向美国从 mydomain.com 以我的国家域名。我的网站是在Word preSS和我将preFER的.htaccess。我已经申请了低于code,但它重定向的所有IP地址为 mydomain.us 。将身体的任何帮助吗?

I want to redirect US country traffic to my country domain from mydomain.com. My website is in Wordpress and i would prefer .htaccess. i have applied the below code but it redirecting all IP addresses to mydomain.us. Will any body help?

GeoIPEnable On
RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} !^(US)$ 
RewriteRule ^(.*)$ http://mydomain.us [R,L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

我的域名mydomains.com和mydomains.us具有相同的结构是怎样的类别和岗位等。我想重定向mydomain.com流量从美国的IP地址到mydomain.us(但全域)

My Domains mydomains.com and mydomains.us has same structure like categories and post etc. i want to redirect mydomain.com traffic from US IPs to mydomain.us (but whole domain)

感谢您的答案被 http://stackoverflow.com/users/2862485/amith http://stackoverflow.com/users/2184393/cafe-$c$cr

推荐答案

您真的应该检查出的文档

在你的情况,请尝试以下重写规则:

In your case, try the following rewrite rule:

GeoIPEnable On
RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^US$ 
RewriteRule ^(.*)$ http://mydomain.us/$1 [R,L]