I use PHP to access a XML data file. I don't want that XML to be access by browser(see) access only data with php. How to block the access to the XML for everithing else except the PHP file?
You'll need to use .htaccess to block that file. If your XML files all have a .xml file extension this oughta do it:
# Block all .xml files from being viewed through a web browser <Files ~ "\.xml$"> Order allow,deny Deny from all </Files>
if I don't have a htdocs I create one myself in the public area ?
This block also the search engines or i have to use a robot.txt file?
This will block everyone. It goes in a file called .htaccess and it needs to be in your root directory.
Keep in mind that no one can find these files unless you someone have their location in your source code. Otherwise the odds of someone finding them will be small.
It is not about finding them in the source code, I want the acces to see to be block for everithing, with the exception of the PHP file the acces the file, like a sql database with a password.
I understand why you want to do it. I just wanted to let you know the odds of anyone finding those files is very remote.