Forum Moderators: phranque
I have tried various things with no success and this is what I am after if anyone can help...
I want to redirect traffic from the US clicking on a certain link to one site and all other traffic to another.
I installed the geoIP module and it is working although i am not sure on how to make the conditional statement to implement the:
If (from US) then
go to US_out_URL_1
Else
go to Non-US_out_URL_2
This is what i got setup, which is not working :(
GeoIPEnable On
GeoIPDBFile /GeoIP.dat
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^US$ [NC]
RewriteRule ^mydomain_URL$ [US_out_URL_1...] [R,L]
Redirect permanent [mydomain_URL...] [Non-US_out_URL_2...]
makes sense that it would not work but I am not sure on how to go about it...
any creative ides?
Thanks for the help,
David
In order to get predictable results, stick to using mod_rewrite for the whole routine.
Jim
I used your idea of rearranging, please let me know if you think there is a better way.
Here is what i did, which is working:
GeoIPEnable On
GeoIPDBFile /GeoIP.dat
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^US$ [NC]
RewriteRule ^mydomain_URL$ [US_out_URL_1...] [R=301]
#redirect non-www to www url
RewriteEngine on
RewriteCond %{HTTP_HOST}!^www\.mydomain\.com
RewriteRule (.*) [mydomain.com...] [R=301,L]
Redirect permanent [mydomain_URL...] [Non-US_out_URL_2...]
Hope this info will help other people who have this problem.
Thanks,
David