I have a site,The site have lot of visitors from international.The site content currently in English.I want to change language dynamically by using PHP code,this done based on the requesting IP address. If the IP address is in US Countries, in server side automatically detect loading language as English. Is this method good for SEO? Is there any alternative solution for this?,Please suggest me.

Thanks in Advance.

3 Answers 3


I want to change language dynamically by using PHP code,this done based on the requesting IP address.

Please avoid automatic language detection based upon origin IP or, if you insist upon using this technique, make it easy for users to select a different language - you will inevitably find that some of your users' IP addresses do not accurately indicate the language which they prefer to use.

The Accept-Language header provided by the user's browser is a better choice for language selection.

Is this method good for SEO?

The goal of any optimization efforts should be to make one's site easy for search engines (as well as visitors) to retrieve and parse; introducing a potential inconsistency would not be advisable.

Ideally, your site will reflect a 1:1 URI:content mapping to allow search engine spiders (which will not set cookies or reliably use a specific IP address) to associate each language's set of URI's with the content specific to the language.

Related questions:

  • Thanks for great information...Please explain what is 1:1 URI:content mapping? Oct 23, 2011 at 11:56
  • For every distinct piece of content (including alternate translations) a distinct Uniform Resource Identifier (URI) (and preferably only one URI) may be used to access the content.
    – danlefree
    Oct 24, 2011 at 1:44

I think you have a lot of solutions to do what you want but the one you said has a little issue (like many other solutions). Infact, think to the follow situation: A man who is english is connected from France. Now your website is going to redirect him to the french version but it should redirect the user to the us/en version. So he (and many others users) will be confused and a little bit bored by this situation.

  • @AurelioDeRosaThe site is not re-directing to the corresponding language folder.It will dynamically detect languages and loaded in same page. Oct 23, 2011 at 10:30
  • @AbdulMajeed It's the same thing. How do you detect the language? Or you're basing on IP, or the locale language set by user or whatever, this is not a 100% method. Oct 23, 2011 at 10:41
  • From global variable $_SERVER["REMOTE_ADDR"].Then find out corresponding country Oct 23, 2011 at 11:08
  • @AbdulMajeed So do you think it's a good method? You're totally wrong. What if the user use a proxy? Or, as I said, he is in a different nation from his native nation? Definitely this is not a 100% method. Oct 23, 2011 at 11:12
  • @AurelioDeRosaYes, I agreed with you.I also ref answer of danlefree.Now i cleared Thank you. Oct 23, 2011 at 11:18

Google generally recommends not to use IP-location as a way of automatically redirecting users to their preferred version:

To make all of your site's content more crawlable, avoid automatic redirections based on the user's perceived language. These redirections could prevent users (and search engines) from viewing all the versions of your site.

Keep in mind that Google - and most other search engines - generally crawl from a single location, so any automatic redirect will lock them into a specific part of your website. On the other hand, if you have separate URLs for all language versions of your site that do not automatically redirect, then search engines will generally be able to crawl and index all versions of the website. It's fine to suggest a specific version to users (say with a JavaScript overlay or "butter-bar"), then those users will be able to reach those language versions faster, but you would not be forcing them.

  • The site is not re-directing.The content will loaded will loaded dynamically based on the IP. Oct 23, 2011 at 10:25
  • The same applies to when you swap out the content for content in the language of the user's perceived language. Oct 24, 2011 at 7:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.