treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Robots.txt

  • May not be the best place for this question, but if I disallow a Robot from a file that is included in another file, will that affect the indexing?

    e.g. I have a PHP Header file, which I don't want indexed on its own because it means nothing. If I set Robots.txt to Disallow: /Header.php will this cause problems when I include the file within the Default.php?
  • I don't think it should affect it at all. Google shouldn't see header.php and index.php as having any relationship with eachother since google can't see the php, only the html.
    User-agent: *
    Disallow: /staging-area/
    Disallow: /includes/
    Disallow: /styles/
    That's within the robots.txt on one of the websites I work on and it seems to be doing fine on google.

    /includes/ contains header.php, footer.php, menu.php, etc.
  • Definitely won't matter. But also most likely isn't necessary. There probably isn't any links to your header.php file so google doesn't even know about it. And if it did, I would think it's smart enough to understand what's happening and not list it in any results.