使用mod_GeoIP的htaccess条件重写规则



我的电子商务网站使用mod_geoip将客户从澳大利亚重定向到同一服务器上的不同店面。商店位于root/store/,我希望它们重定向到root/austore/

我已经得到了它,所以基本的重写可以完美地工作,但我希望url结构是一样的。例如,如果有人点击了root/store/category/product/的链接,并且他们住在海外,我希望他们被重定向到root/austore/categy/product/,因为两个商店的文件结构相同。现在,如果他们点击该链接,它会将他们重定向到基本的root/austore/。

这是目前的重写规则。

Options +FollowSymLinks
RewriteEngine on
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^AU$
RewriteRule ^([^/]+)$ /austore/ [L]

我正在编辑的.htaccess文件在存储/目录中。

如有任何帮助,我们将不胜感激。谢谢

Allan

尝试

#skip processing /store/skin/ directory
RewriteRule ^store/skin/  - [L,NC] 
#if they live overseas i.e not Australia
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} !^AU$
#if someone clicks on a link that is root/store/category/product/ 
RewriteCond %{REQUEST_URI} ^/store(/.*)$ [NC] 
#I want them to be redirected to root/austore/category/product/ 
RewriteRule ^ /austore%1 [L,R]

最新更新