Forum Moderators: phranque

Message Too Old, No Replies

Htaccess and geo targetting

         

onehundredandsix

4:57 pm on Jan 12, 2009 (gmt 0)

10+ Year Member



Hi all,

I found the forum when searching for (as non-techy as possible!) advice on implementing "geo targetting" (if that's the correct phrase for it?) using .htaccess as I'm trying to do something beyond my skills re: my business' website...

Background: I run an accommodation website and want to incorporate some "geo targetting" i.e. direct visitors to a handful of country-specific content pages based on their IP address/country code e.g French visitors to www.domain.co.uk/fr/index.shtml; German visitors to www.domain.co.uk/de/index.shtml etc. and anyone who I'm not giving special attention to the standard index.shtml. ("Phase 2" if you like will be (for me) to pair this with Adwords targetting.)

I'd also like (within the same coding?) to single out a few IP's (competitors) who seem to like to copy my ideas and redirect them to maybe a 404 or a "no frills" website whilst masking the address/subdomain they are being sent to instead of index.shtml

And finally (!) I'd like to include the Nigerian IP address blocks that I am utilising at the moment.

I have (initially?) opted to use MaxMinds' GeoLite Country to
achieve the above (but I'm open to other suggestions of suitable, preferably free databases). I contacted our hosting company who tell me that we're on a Linux server (so GeoIP should work fine) but they advised me to use php rather than an htaccess redirect *goes right over my head* but my pitiful attempts to code this properly have failed to work (shock!)

I have server access (obviously!), I know my way around html and css and I have experience of .htaccess but only so far as blocking Nigerian visitors in their entirely using blocks of IP
addresses c/o a country blocking website batch list! But the code required to implement what I want to achieve completely eludes me. I have posted on a few forums looking to hire someone freelance to do this for me but no-one has replied (too small a job? too easy a job? too hard a job?), I don't know (yet!) (I've posted it in about six SEO/website design forums!) and I had intended to post it on here as a "wanted ad" but as I am 199 posts shy of full member I cannot - so the Gods must be telling me to stop being lazy and learn to do it myself!

So, right now I going with MaxMinds' GeoLite Country. So far I have uploaded geoip.dat and geoip.inc onto our hosts server (both are in the html directory - I keep reading things about httpd and I have access to this folder but I'm not sure if the geoip.dat and geoip.inc need to go there as well/instead?

If anyone could answer my questions here, and/or direct me to as non-techy a walk-through as possible (MaxMind's own forums are dead and their instructions are sadly of no help to a beginner) I'd be very, very grateful.

Many thanks in advance for any replies!

jdMorgan

1:41 am on Jan 13, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmmm... Well, I'll give you an opinion I share with *some* webmasters and Web users that may save you some hassle, time, and money. I don't know that we're the majority, but if we're a minority, we're a significant one...

GeoIP redirection annoys me. Just because I'm sitting in a Tokyo hotel room doesn't mean I read Japanese! And just because I stop in at a Bangkok internet cafe doesn't mean I speak Thai! I'm OK in Paris, 'cause I spoke French fairly fluently as a kid, but otherwise... "Fuhggedahbowdit" (that's en-NY if you want to look it up in the map) :)

So, redirection or content-negotiation fails using either geolocation based on IP addresses or based on browser language preferences. Why? Because the correlation between location and language no longer works in the Jet Age, and the correlation between browser Accept-Language preferences and user language is not necessarily very strong either. The you have multi-language countries like ca, be, and ch with two or more languages spoken even within the same country. It's a big tangle!

So, when I visit your site, what I'd like to see --and it's quite common in the travel sector-- is a simple world map or regional map, so I can just click on where I want to go. And maybe a row of flags across the top or down the side to pick my preferred language... Simple, flexible, non-presumptuous, and cheaper than a contractor! :)

As for the rest, you'll do best to post one question at a time and make it specific. We're kind of a "self-help and learning" forum here due to a somewhat-limited number of contributors, so the kind of posts that get the best responses are those that start off, "I'm trying to do 'xyz' because I need to 'abc', and here's the code I tested. But when I tested with the URL 'def', the result was 'ghi', but I expected 'jkl'! I'm not sure what is wrong, but I don't feel very confident in the code line that says 'mno', so that may be where the problem is..."

If you haven't found them yet, we have a Forum Library and our Charter contains links to several useful resources as well. The links to both are at the top of this page and most pages here at WebmasterWorld.

Jim

onehundredandsix

2:49 am on Jan 13, 2009 (gmt 0)

10+ Year Member



Thank you for your reply Jim and your comments re: the use of GeoIP redirection, I should probably have phrased my background a bit better but I am the accommodation provider as in beds, breakfast, check-in's and keys rather than say a commissions based re-seller or travel agent.

The reason/intention with the GeoIP is that we have guests who seek accommodation in the area who are from specific countries with a specific reason for travelling here. E.g. we are a ten minute walk from a marine training college where international students come to sit ten days worth of masters exams, these bookings are very favourable to us, ten days of very quiet studious ship-captains-to-be on an almost continual basis. Now I'd say that 100% of the Indian visitors to our accommodation stay with us for their exams and I'd like the landing page for visitors from India to emphasise our free wireless internet access, how we are ten minutes walk to the college, our weekly room rates and laundry facilities etc. to help ensure that they stop looking around elsewhere and book a room with us there and then. I wouldn't want to exclude the Indian site visitors from looking at all parts of our website but I think "conversions" i.e. turning lookers into bookers, would be greatly improved if the 'Indian landing page' was presented as I've described above.

In comparrison Australian visitors want to know how far we are from the airport, that car hire is available nearby, a good choice or restaurants and our proximity to local studies centres (for geneology research) etc. so I'd perhaps do Australian landing page focusing on such things.

Another 'guest type' would be a home (UK) visitor staying with us for a weekend who doesn't care about laundry facilities or local studies centres so a UK/generic landing page would be different again. I'm not trying to steer people away from all areas of the website I'm just trying to effectively market our business to particular groups of customers that we've identified.

For the record, I intend to leave the language as English throughout and we have a small header.html that rests above every page that contains a comprehensive language bar that will translate the page content below according to the flag clicked - this I wouldn't change. The visitor can pick their own language, I'm not trying to force Dutch on anyone!

Sorry for the (second!) ramble there, I did post shorter paragraph-long questions on other forums but didn't get any response at all so I tried and failed with another tactic here.

Back to the drawing board! I shall check out the forum library now...

jdMorgan

3:17 am on Jan 13, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's rather a mystery to me why you haven't got a response to your posts on the "work for hire" boards. I'm fairly sure we'll have someone who reads here who has installed a GeoIP lookup script before, I'm just not at all sure when or if that person might show up and find and read your thread...

Short. Concise. Focused. Good. :)

Jim