Carasuman
Carasuman

Reputation: 666

how to block access of XML file

I created a config file in XML (config.xml) index.php reads config.xml and gets all configs(database user/pass, and other things). The problem is if you enter to http://example.com/config.xml you can read all the xml file and that is a security risk. I tried with chmod 600 but group(apache) cant read the file. You knows a way to read xml in php and blocks the access outside the server? Thanks for help.

Upvotes: 1

Views: 1558

Answers (1)

CappY
CappY

Reputation: 1580

try htaccess.

<Files config.xml>
order allow,deny
deny from all
</Files>

Upvotes: 4

Related Questions