Of all the operators in google site: is probably the most useful, because it lets you narrow your results from the whole web to just a portion of it. I want to talk a bit about how it is used in general and then focus in on using this tool to search subdomains. I should warn though that this particular research tip might get a bit more technical than some of my other ones.
It is used to search all the pages on a specific domain, [site:cbc.ca]. or a specific directory of a specific domain [site:toronto.ca/councillors]. It can also be used to search a top level domain, [site:org], second level domains [site:gc.ca], (the later allows you to search all canadian government websites). It can also be used to search subdomains, [site:navy.forces.gc.ca]
But before I go into a bit more detail on searching subdomain I want to break down a url and explain what a subdomain is. Take this site for example:
‘Calgary’ is a directory, ‘ca’ is a top level domain, ‘gc’ is the second level domain, ‘forces’ is the domain, ‘navy’ is the subdomain, and ‘www’ is a prefix used to signify the hostname
for a web server
(in contrast to the prefix ftp for an ftp server.) – am I still with you?
Most websites don’t use subdomains, but they are certainly out there on the web. Sometimes a web developer employs them merely to create a desired url, or as a an alternate way of organizing information, but it can also signify that the information is being served from a separate machine.
Searching for a specific subdomain can be done like this: [site:subdomain.example.com], however searching [site:example.com] would get you all pages from that site including from the subdomain. However I wanted to point out that searching for [site:www.example.com] would not search all the pages at example.com, the correct search to do that would be [site:example.com]. That is because the www is treated as a subdomain, and thus eliminates all other subdomain.
When I search the Canadian Forces website like this site:www.forces.gc.ca I am missing pages like army.forces.gc.ca, in that particular case the vast majority of pages are found in subdomains.
In general I avoid using www in my site: searches, unless I have a good reason to leave it in.
It is rare, but on a couple occasions I have found this search useful <site:example.com -site:www.example.com> basically it is a way to get you a sense of what subdomains exist. If a particular subdomain contains a particular type of information then you can focus in on that subdomain.
I hope that is clear, and useful. I explained the part of a URL and the use of subdomains as simply and as accurately as I could, but if any tech experts want to school me on anything I have explained wrong I would appreciate it.