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!
A. Robots rely on links. The include is all server-side... the robot won't know you even included that file.
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.
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!
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.