Working With Google URLs

Advanced Google users begin testing advanced queries right from the Web interface’s search field, refining queries until they are just right. Every Google query can be represented with a URL that points to the results page. Google’s results pages are not static pages.They are dynamic and are created “on the fly” when you click the Search button or activate a URL that links to a results page. Submitting a search through the Web interface takes you to a results page that can be represented by a single URL. For example, consider the query ihack stuff. Once you enter this query, you are whisked away to a URL similar to the following:

www.google.com/search?q=ihackstuff

If you bookmark this URL and return to it later or simply enter the URL into your browser’s address bar, Google will reprocess your search for ihackstuff and display the results. This URL then becomes not only an active connection to a list of results, it also serves as a nice, compact sort of shorthand for a Google query. Any experienced Google searcher can take a look at this URL and realize the search subject.This URL can also be modified fairly easily. By changing the word ihackstuff to iwritestuff, the Google query is changed to find the term iwritestuff.This simple example illustrates the usefulness of the Google URL for advanced searching. A quick modification of the URL can make changes happen fast!

URL Syntax

To fully understand the power of the URL, we need to understand the syntax.The first part of the URL, www.google.com/search, is the location of Google’s search script. I refer to this URL, as well as the question mark that follows it, as the base, or starting URL. Browsing to this URL presents you with a nice, blank search page.The question mark after the word search indicates that parameters are about to be passed into the search script. Parameters are options that instruct the search script to actually do something. Parameters are separated by the ampersand (&) and consist of a variable followed by the equal sign (=) followed by the value that the variable should be set to.The basic syntax will look something like this:

www.google.com/search?variable1=value&variable2=value

This URL contains very simple characters. More complex URL’s will contain special characters, which must be represented with hex code equivalents. Let’s take a second to talk about hex encoding.

Special Characters

Hex encoding is definitely geek stuff, but sooner or later you may need to include a special character in your search URL. When that time comes, it’s best to just let your browser help you out. Most modern browsers will adjust a typed URL, replacing special characters and spaces with hex-encoded equivalents. If your browser supports this behavior, your job of URL construction is that much easier.Try this simple test.Type the following URL in your browser’s address bar, making sure to use spaces between i, hack, and stuff:

www.google.com/search?q=”i hack stuff”

If your browser supports this auto-correcting feature, after you press Enter in the address bar, the URL should be corrected to www.google.com/search?q=”i%20hack%20stuff ” or something similar. Notice that the spaces were changed to %20.The percent sign indicates that the next two digits are the hexadecimal value of the space character, 20. Some browsers will take the conversion one step further, changing the double-quotes to %22 as well.

If your browser refuses to convert those spaces, the query will not work as expected. There may be a setting in your browser to modify this behavior, but if not, do yourself a favor and use a modern browser. Internet Explorer, Firefox, Safari, and Opera are all excellent choices.

Putting the Pieces Together

Google search URL construction is like putting together Legos.You start with a URL and you modify it as needed to achieve varying search results. Many times your base URL will come from a search you submitted via the Google Web interface. If you need some added parameters, you can add them directly to the base URL in any order. If you need to modify parameters in your search, you can change the value of the parameter and resubmit your search. If you need to remove a parameter, you can delete that entire parameter from the URL and resubmit your search.This process is especially easy if you are modifying the URL directly in your browser’s address bar.You simply make changes to the URL and press Enter. The browser will automatically fetch the address and take you to an updated search page. You could achieve similar results by poking around Google’s advanced search page and by setting various preferences, as discussed earlier, but ultimately most advanced users find it faster and easier to make quick search adjustments directly through URL modification.

A Google search URL can contain many different parameters. Depending on the options you selected and the search terms you provided, you will see some or all of the variables listed in Table.These parameters can be added or modified as needed to change your search criteria.

Table Google’s Search Parameters

Screenshot from 2020-05-18 17-05-02

Screenshot from 2020-05-18 17-06-43

Screenshot from 2020-05-18 17-07-45

Screenshot from 2020-05-18 17-08-54

Some parameters accept a language restrict (lr) code as a value.The lr value instructs Google to only return pages written in a specific language. For example, lr=lang_ar only returns pages written in Arabic.Table 1.3 lists all the values available for the lr field:

Table Language Restrict Codes

Screenshot from 2020-05-18 17-11-15

Screenshot from 2020-05-18 17-11-58

The hl variable changes the language of Google’s messages and links. This is not the same as the lr variable, which restricts our results to pages written in a specific language, nor is it like the translation service, which translates a page from one language to another.