19

Let's say I ran the following query in Google's web search:

site:"superuser.com" "windows 7"

This will return results on the blog.superuser.com subdomain.

How can I restrict results to only be from the superuser.com domain and not any other subdomain?

5

This will do the trick:

[ "windows 7" site:superuser.com -site:*.superuser.com ]

This method has varying results and does not work for sites such as

  • stackexchange.com
  • cnn.com
  • fox.com
  • internet.com
  • This works, until a new subdomain is added. Probably better to change it to -site:*.superuser.com. – mindless.panda Jul 26 '11 at 20:06
  • 2
    Doesn't work for a domain like stackexchange.com - replace your example with stackexchange.com and you'll see tex.stackexchange.com and apple.stackexchange.com come up – Eight Days of Malaise Oct 3 '11 at 12:48
  • 2
    This also does not work for: bbc.co.uk, cnn.com, fox.com, internet.com, cnet.com, etc – Eight Days of Malaise Oct 3 '11 at 14:17
  • This does not work at all, it just happens to work for the domain in the question by chance. webapps.stackexchange.com/q/19493/10579 – Pacerier Oct 3 '11 at 15:18
7

Rather than using the site: search operator try using inurl: instead along with the + operator. Seems to work pretty well for me.

asd +[inurl:http://stackexchange.com]

or in the case of this question:

"windows 7" +[inurl:http://superuser.com]

Note: Posting this answer in response to this recent duplicate question

Tests for other sites

  • newspulse +[inurl:http://cnn.com] no newspulse.cnn.com
  • The Latest Scripts from JavaScript Source +[inurl:http://internet.com] no javascript.internet.com
-2
site:superuser.com -site:*.superuser.com "windows 7"
  • This seems to be identical to the solution in this answer, which apparently doesn't work. – ale Apr 5 '16 at 15:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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