Hi guys,

I need your help. I have .xml file in download directory on my server. whoever visit my site page (Myxmlfilename.xml) user should be able to download these files and other files should not.

I am trying to achieve above but no luck...

does anyone know how I can access to Myxmlfilename.xml to download the xml file?

thank you in advance.

3 Years
Discussion Span
Last Post by cereal

Since in .htaccess the rules have a cascading order, for a simple "manual" solution you could save this .htaccess file into the download directory:

<Files "*">
order allow,deny
deny from all

<Files "Myxmlfilename.xml">
order allow,deny
allow from all

This would deny the direct access to all the files, except to Myxmlfilename.xml. For a complex solution you could:

  1. separate the files in a public download directory and a reserved, or
  2. deny direct access to the download directory and use a script to serve the files, for example:
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.