![]() |
Can I redirect visitors from specific countries by using .htaccess?
I want to redirect visitors from specific countries, can this be done with htaccess? If yes, then what is the code I need?
|
You can use .htaccess to pre-append a php file to be included on all of your pages.
In that php file you can do the geo-targeting. Check out www.maxmind.com for php scripts to geo-target or whip up a self-made solution using Lee's tutorials at ARS Resources. |
Redirecting by country or region would be hard to do with .htaccess, because of the loose association between IP assignments and countries... but there are services out there that keep up with this, and with some work, you may be able to get a good database of them going.
These links might be a starting point: http://www.ip-to-country.com/ http://where-is.info/help.html |
trafficjuicer.com - 3 lines of cut and paste code into html.
|
You can do it based on browser language via .htaccess, but the issue is whether browser language is accurate enough for what you want to do with your traffic.
If its just being used to block .jp traffic, then htaccess probably is sufficient. If you wanna redirect lots of different countries to different page/show different content, then you need a proper script. Hit me up richard {at} ip-sorter.com or icq 41012160 if you wanna chat about foreign country filtering / redirecting / targeting etc. Check this url if you're happy with doing it in htaccess: http://www.bowiesnyder.com/writings/nls_apache.htm |
| All times are GMT -7. The time now is 10:51 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123