hiding php files from bots? robot strategy...

Discussion in 'PHP' started by lookingswell, Nov 6, 2007.

  1. #1
    so i'm making a basic website and am using the include function

    index.php:

    <html>...
    blah blah
    <?php include("menu.php"); ?>
    blahblah
    ...</html>

    and menu.php:
    <a href... link A </a><br>
    <a href... link B </a><br>
    <a href... link C </a>

    so i want index.php to be indexed into search engines, but i wouldn't want menu.php to be indexed, since it isn't valuable in it of itself - only when inlcuded in index.php or other "complete" files that include it - and don't want redundancy...

    my question is: should i:

    a) not worry about it, since the bot wont go to it unless you directly link to it?
    b) create a robot.txt files and forbid menu.php?
    c) other approach?

    thanks!
     
    lookingswell, Nov 6, 2007 IP
  2. garbageman

    garbageman Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    A.
    Robots rely on links. The include is all server-side... the robot won't know you even included that file.
     
    garbageman, Nov 6, 2007 IP
  3. kentuckyslone

    kentuckyslone Notable Member

    Messages:
    4,371
    Likes Received:
    367
    Best Answers:
    0
    Trophy Points:
    205
    #3
    php includes are "server side includes" that means they are interpreted before the info is sent to the browser - or the bot. To see what I mean go to one of your pages that uses an include and view source. You will see that all the code, including that from the include files, is there with no reference to the include file itself.
     
    kentuckyslone, Nov 6, 2007 IP
  4. lookingswell

    lookingswell Peon

    Messages:
    22
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    yeah i knew that, but wasn't sure if the bot was able to look at the file just because it exists in the directory, not because it's linked to since it's not. thanks though!
     
    lookingswell, Nov 6, 2007 IP
  5. kentuckyslone

    kentuckyslone Notable Member

    Messages:
    4,371
    Likes Received:
    367
    Best Answers:
    0
    Trophy Points:
    205
    #5
    You are welcome. The bot doesnt see the include file as a seperate thing. It sees the code from the include as part of the page itself.
     
    kentuckyslone, Nov 6, 2007 IP