25

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?

6 Answers 6

9

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
4
  • This works, until a new subdomain is added. Probably better to change it to -site:*.superuser.com. Jul 26, 2011 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 Oct 3, 2011 at 12:48
  • 2
    This also does not work for: bbc.co.uk, cnn.com, fox.com, internet.com, cnet.com, etc Oct 3, 2011 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, 2011 at 15:18
8

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
0

Add inurl:www

site:"superuser.com" "windows 7" inurl:www

It seems to work perfect for me!

Another option would be to use the - operator to exclude the individual subdomains manually.

Eg:
site:"superuser.com" "windows 7" -inurl:subdomain

-1

Another simple way to do that is to specify which subdomain you want to be cuted off from the final query, you can do as follows:

site:domain.com -subdomain -subdomain
1
-3
site:superuser.com -site:*.superuser.com "windows 7"
1
  • 2
    This seems to be identical to the solution in this answer, which apparently doesn't work.
    – ale
    Apr 5, 2016 at 15:58

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.