GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   htaccess redirect rule help needed. (https://gfy.com/showthread.php?t=1053805)

sponsorpimp 01-17-2012 07:06 AM

htaccess redirect rule help needed.
 
I want to redirect GB visitors to a diffrent URL by using htaccess I have tried the code below with no luck at all can anyone help!

RewriteEngine On
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^GB$
RewriteRule ^(.*)$ http://gb.example.com$1 [L]



Thanks :)

darksoul 01-17-2012 07:12 AM

the code should do just make sure you have mod_geoip installed

sponsorpimp 01-17-2012 07:37 AM

Is there a simple way of doing this for affiliates? like some simple code they can put on the home page to redirect traffic from the UK to another site?

I need it as simple as possible for affiliates to get around without having to install anything on the server.

klinton 01-17-2012 07:52 AM

you can also redirect by browser language... it's not 100 % accurate however...

google how to do it ;-)

oh wait, i have one url for you ;]
http://www.htaccesstools.com/redirection-by-language/

sponsorpimp 01-17-2012 08:09 AM

Quote:

Originally Posted by klinton (Post 18693254)
you can also redirect by browser language... it's not 100 % accurate however...

google how to do it ;-)

oh wait, i have one url for you ;]
http://www.htaccesstools.com/redirection-by-language/

Thanks for the info but not quite what I am looking for as it must redirect only UK visitors which is English so it would redirect all English counties and not just the UK (GB)

Like the site though...

raymor 01-17-2012 08:27 AM

Quote:

Originally Posted by sponsorpimp (Post 18693219)
Is there a simple way of doing this for affiliates? like some simple code they can put on the home page to redirect traffic from the UK to another site?

I need it as simple as possible for affiliates to get around without having to install anything on the server.

No. They could redirect based on remote_host if their server has reverse resolution on, but it shouldn't be on. It's very resource intensive.

klinton 01-17-2012 08:46 AM

Quote:

Originally Posted by sponsorpimp (Post 18693290)
Thanks for the info but not quite what I am looking for as it must redirect only UK visitors which is English so it would redirect all English counties and not just the UK (GB)

Like the site though...

for uk english it should be: en-gb code....
for australia it is: en-au, for usa it is en-us..... and so on....
however, like I told, it's not 100 % accurate, so I think your only other way is only by using geo IP redirect... :)

Nasty 01-17-2012 08:59 AM

Quote:

Originally Posted by sponsorpimp (Post 18693152)
I want to redirect GB visitors to a diffrent URL by using htaccess I have tried the code below with no luck at all can anyone help!

RewriteEngine On
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^GB$
RewriteRule ^(.*)$ http://gb.example.com$1 [L]

Thanks :)

heres mine

Code:

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


sponsorpimp 01-17-2012 10:19 AM

Thanks for the answers, anyone else?

fris 01-17-2012 11:04 AM

you want what nasty has, unless you want to do it via php code

raymor 01-17-2012 12:26 PM

Quote:

Originally Posted by klinton (Post 18693361)
for uk english it should be: en-gb code....
for australia it is: en-au, for usa it is en-us..... and so on....
however, like I told, it's not 100 % accurate, so I think your only other way is only by using geo IP redirect... :)

Also geo isn't anything like 100% accurate, as the main geo ip company, Maxmind, clearly states.


All times are GMT -7. The time now is 05:40 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123