Jump to content

Redirect Users By Country Using Php?


Jamesking56

Recommended Posts

I want to make a Country Redirector using PHPHow can I do this?I want to get the User's IP Address and redirect them to certain pages based on their countryIf the country cannot be found I want to display a page with Flags on it so they can click their country's flag.How can I do this?

Link to comment
Share on other sites

I usually find that annoying (I am in Spain and I want to view the pages in English). You should give people the option to view the site in another language if they want to, even if you do redirect them.You either need an IP database service (there are lots of them online, Google can help you there) or you can just use the language header sent from the client (I think the variable is $_SERVER['HTTP_ACCEPT_LANGUAGE'] but I'm not sure).In either case, if the IP or language header is not found (or they're empty) you can redirect them to the page with links.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...