Deny direct access to PHP file
php
Solution
You should place all files that you only include in a directory, and block access to that directory using a `.htaccess` file.
This will prevent Google as well as users from accessing the file directly.
Your `.htaccess` file should contain
`deny from all`
You create a directory called 'fragments' and drop `top.php` in there. Then, within the directory create a new file called `.htacess`. The file should contain `deny from all`.
Creating a file without any name and only an extension can be done this way:
- Go to notepad and type `deny from all`
- Click on Save As
- Select 'Save as type' to be 'All files' and name `".htacess"` (with the quotes)
Problem
When designing a website I created a top.php page to hold the essence of my page so I could just use include for each page. So top.php holds my head, with my CSS stylesheet and with it my background to the site and then the menu bar. I've used absolute positioning with my content so everything just sits on top of an image basically - the template. Impractical perhaps but it does look nice. Anyway if you were to access mywebpage.com/top.php you just see the template with no content obviously. Now it wouldn't really be a problem because nobody would go to that link except Google has decided to include it in it's search. Even though I've submitted a sitemap and hidden it on my Google Web Account. Any solutions? I'm not an experienced web designer obviously.