Results 1 to 9 of 9
  1. #1

    Default .htaccess and download folder

    I have been working on securing the download folder. I've been able to move it behind the public_html but I'm confused about the .htaccess file...

    In the article https://www.zen-cart.com/tutorials/i...hp?article=121 "How do I secure my Downloads folder to prevent theft?" it says:

    Zen Cart already provides .htaccess protection for that folder. You could (should) update that file to add the file-extensions for all the types of files in your downloads folder. Thus, people using a browser cannot directly access any files matching those extensions.
    I have been doing some research and I'm not sure how to "add the file-extensions". Do I just list the them? Use commons? Have to give it some instruction beforehand?

    Here is the download folder .htaccess as it sits. If I want to add, say, .zip and .exe to is how would it look?

    Code:
    #prevent directory browsing -- for security
    IndexIgnore */*
    
    AuthType Basic
    AuthName "No access"
    AuthUserFile .htnopasswd
    AuthGroupFile /dev/null
    Require valid-user
    "Yeah. Mortal combat with unseen forces, I should deprive myself of telepathic information to spare you irritation -- from cheeping." ~ Bill Jacks, "John From Cincinnati" http://www.savejfc.net

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: .htaccess and download folder

    If you have relocated it above public_html then you do not require any additional web access measures as it is up out of normal web access space

  3. #3

    Default Re: .htaccess and download folder

    I'm sorry for not being clear. I skipped over an important piece of information...

    The site ZenCart is on is a subdomain of my main hosting account.
    After moving the download folder behind public_html I realized that the only way to upload files there would be to give the person running the site full access to all my domains, which I am not prepared to do. So I moved the download folder into my main hosting account (one level up from the site ZenCart is on) and gave him ftp permission for that folder only.

    So I still need to know how to add the file extensions to the .htaccess.

    TIA!
    "Yeah. Mortal combat with unseen forces, I should deprive myself of telepathic information to spare you irritation -- from cheeping." ~ Bill Jacks, "John From Cincinnati" http://www.savejfc.net

  4. #4
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: .htaccess and download folder

    Guess I am confused now???

    Are you trying to force "download of file types" or upload?

    If as the thread is titled "download" it would be along the lines of
    Code:
    AddType application/octet-stream .mov
    AddType application/octet-stream .avi
    AddType application/octet-stream .mpg
    AddType application/octet-stream .jpg
    AddType application/octet-stream .mp3
    Where your files types are listed one per line

  5. #5

    Default Re: .htaccess and download folder

    I'm trying to follow the instructions in the article that says:

    You could (should) update that file to add the file-extensions for all the types of files in your downloads folder.
    I gave you the information about unloading because that is the explanation as to why I still needed the information after you told me that I didn't need it anymore...

    Bottom line: Is the code you offered in your last post what they were referring to in the article?

    Oh, and I read somewhere about using the word "stream" only being necessary on Windows servers. The site is in Linyx.
    "Yeah. Mortal combat with unseen forces, I should deprive myself of telepathic information to spare you irritation -- from cheeping." ~ Bill Jacks, "John From Cincinnati" http://www.savejfc.net

  6. #6
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: .htaccess and download folder

    Yes and octet-stream is used to force ONLY downloading

  7. #7

    Default Re: .htaccess and download folder

    Great. One last point...

    I assume that it will also work for:

    Code:
    AddType application/octet-stream .zip

    Correct?
    "Yeah. Mortal combat with unseen forces, I should deprive myself of telepathic information to spare you irritation -- from cheeping." ~ Bill Jacks, "John From Cincinnati" http://www.savejfc.net

  8. #8
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: .htaccess and download folder

    I believe the FAQ article was referring to preventing Directory Listings more than specifying how certain filetypes are to be served.

    If you're serving your files via redirect, then any AddType directives in your /download/ folder will be entirely ignored because the files are served from the /pub/ folder as part of the redirect. And if using Download by Streaming, then the AddType directives are also moot because the streaming is done by PHP, not by the filesystem or Apache.
    .
    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  9. #9

    Default Re: .htaccess and download folder

    Ahhh... I understand now. Thank you for the additional information.
    "Yeah. Mortal combat with unseen forces, I should deprive myself of telepathic information to spare you irritation -- from cheeping." ~ Bill Jacks, "John From Cincinnati" http://www.savejfc.net

 

 

Similar Threads

  1. Changed site root folder and now have bad htaccess problem(s)
    By bodkin77 in forum General Questions
    Replies: 8
    Last Post: 30 Apr 2013, 10:57 AM
  2. COWOA won't allow customer to download file from download folder
    By fawad123 in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 18 May 2011, 01:27 PM
  3. Folder Permissions, and htaccess
    By crabacle in forum Basic Configuration
    Replies: 2
    Last Post: 22 Sep 2009, 03:09 PM
  4. download folder - .htaccess file
    By mipavluk in forum General Questions
    Replies: 6
    Last Post: 10 Feb 2009, 03:05 AM
  5. Adding file extensions to .htaccess in download folder
    By ingoito in forum General Questions
    Replies: 0
    Last Post: 28 Jan 2009, 09:11 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg