0

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?

2
Contributors
5
Replies
6
Views
10 Years
Discussion Span
Last Post by stymiee
0

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>
0

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?

0

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.

0

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.

0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.