Monday, April 25, 2011

How to Customize Google Country Redirect in Firefox

This article discusses about how to change Google country redirect to whatever your want from firefox permanently.

The Problem
Google automatically redirects to the Google's country domain depending on your IP address. If you are using Google search through a proxy or if you are traveling, you might have experienced this.

Solution 1: Always get results from Google.com

One way to stop Google country redirect is to visit this link: http://www.google.com/ncr. This sets a cookie in your browser announcing Google not to redirect. Now you are getting results from google.com. But this solution fails if you remove cookies in Firefox. And the other problem is that you’ll not get country-specific search features.

Solution 2: Get results from your favorite Google country domain

Firefox’s default search bar gets its configuration options (what search engine to use, what parameters to pass, etc) from XML files located in ’searchplugins’ directory in Firefox’s default directory. If you are on a Windows system this most probably be ‘C:\Program Files\Mozilla Firefox\searchplugins’. There’s an XML file for Google called ‘google.xml’. Following is the content of that file.


Google
Google Search
UTF-8



  

http://www.google.com/
 
XML tags hare are self-explanatory. First copy google.xml and make a new one. Lets’ call it ‘google.lk.xml’ for examples. Then Edit ‘ShortName’, tag and rename it to something else. Let’s call is “Google.lk”. Then there are two ‘Url’ tags. Leave the first ‘Url’ tag as it is since it’s used to get search suggestions. In the second tag change template attribute to template="http://www.google.lk/search".

Change http://www.google.com/ to http://www.google.lk within '<SearchForm>' tags. This specifies the page to display if you click on the magnifying glass icon, at the left hand corner of the search bar, without any search terms.

After these changes are made, new google.lk.xml file should look like follows.


Google LK
Google Search
UTF-8



  
  

http://www.google.lk/
If you are in a different country than Sri Lanka, use your country’s Google domain instead of google.lk.
Finally, you have to select “Google.lk” from the search engine list in Firefox's search bar (Click on the small traigle next to search engine logo)

4 comments:

  1. Dharshin, This does not work for me.
    I am quite a technical chap so your not talking to a complete noob.
    I use firefox,"FF" on a win 7 64bit
    with an open source gateway
    I have a homepage set to google.com.ncr
    but the problem is i use ctrl+enter alot.(going to abbriviate that to "C+E")
    and when i C+E google.com it still redirects
    is there a way in FF, about:config
    to stop google.com from redirecting with out the addition of /ncr

    I have tried your steps above modding the xml file but it does not seem to do anything.
    asidscript@gmail.com

    ReplyDelete
  2. @Daniel

    You cannot stop automatic redirection to country domain by editing the XML. It's helpful if you are using some sort of proxy like tor.

    You must use the Firefox's search bar to get your search in correct Google domain. If you just enter www.google.com, it will always redirect you to the local Google domain, if you have not set the /ncr cookie.

    ReplyDelete
  3. worked for me...but if you're changing the existing file rather than a copy...change the filename too.

    ReplyDelete
  4. Even changing the homepage domain to www.google.com/ncr doesn't work for me. I think you have to go into Control Panel and change the geographic settings to make the computer "reside in" the country you want.

    ReplyDelete

Please note that comments are moderated in order to stop comment spam. Comments with unwanted links (those who are trying to use blackhat SEO) are reported as spam.