Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have my personal homepage, and I want the main page itself to appear in search results. But I do not want a certain directory and its subdirectories to appear in google search results. How do I do this?

share|improve this question
up vote 3 down vote accepted

There are several mechanisms you can use to do this.

The first is the robots.txt file. This is a protocol which is voluntarily followed by "good" search engines by google, and allows you to list sections of your site which they will not follow.

User-agent: *
Disallow: /myfolder/

The next is meta tags. Individual pages can be tagged with metadata which tells robots not to index or display them. Google has a nice writeup on how to implement these.

<meta name="robots" content="noindex,nofollow">

The final mechanism, if the pages have already been indexed, is to use the search engine's removal mechanism if one exists. I've linked to the documentation for Google, Bing, and Yahoo's removal mechanisms here:

share|improve this answer
+1 Nice, thorough answer. – Andy West Jul 15 '10 at 20:47

disallow the search bots to enter these locations:


google describes the procedure pretty good, example given:

User-agent: *
Disallow: /folder1/

This disallows all bots to index the content of "/folder1/"

share|improve this answer

Use a robots.txt file in your main folder and set it to:

User-agent: *
Allow: /

In the folder you don't want anyone to access put a robots.txt file with this body:

User-agent: *
Disallow: /

Checkout http://www.robotstxt.org/ for more info about robot.txt files.

share|improve this answer
robots.txt files won't get picked up in subdirectories, only at the document root. – JasonBirch Jul 16 '10 at 3:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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