ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How can I protect a folder of files from public access, but allow EE templates to access them for a specific member group?

October 02, 2012 1:43am

Subscribe [2]
  • #1 / Oct 02, 2012 1:43am

    bgarrant

    356 posts

    I have a folder with a eBook made up of many files (HTML, FLASH, JPGs) that I want to protect from public browsing as they should only be viewable after purchased.  The eBook is made up of many files and images so it is not one packages PDF for example.  The eBook link is like http://domain.com/uploads/secure/ebook/index.html.  I cant just move the index.html into a template either as the image and flash links will break.

    How can I protect this folder and only allow paid customers to access the URL since it is not a downloadable file?  The eBook is only viewed in the browser and not downloadable.  I thought HTACCESS would work with “deny from all”, but once I lock the folder down I am not sure how to allow the viewing of the eBook by paid members?

    Any help is greatly appreciated.

    Bryan

  • #2 / Oct 02, 2012 2:00am

    bgarrant

    356 posts

    It sounds like I need some form of htaccess and htpasswd to protect the secure folder and then I need to pass the authenticated password via a member protected template to allow the file to be viewed.  Anyone know how to do this?

  • #3 / Oct 02, 2012 10:05am

    bgarrant

    356 posts

    Can anyone help with this?  I have a site LIVE and desperately need to wrap up this security part.  Thank you.

  • #4 / Oct 03, 2012 2:30pm

    bgarrant

    356 posts

    Not one reply?  Has anyone needed to do this before?

  • #5 / Oct 03, 2012 3:41pm

    Bhashkar Yadav

    727 posts

    Hi Bgarrant,


    It would be better to create a file or template which will first check for paid customer and then read the content of file then will show on browser.

    To prevent the files of that folder from direct access, put a htaccess file into it with the rule “deny from all”.

    i didn’t implemented such like feature yet, but hope this logic would help you.


    Best Regards,

  • #6 / Oct 03, 2012 4:00pm

    bgarrant

    356 posts

    I tried that but when I use code like you see below in the template the image is hidden due to the restriction.  How can I get the images to show from the protected folder while keeping HTACCESS in effect?

    Template Code

    <h2>this is a test file</h2>
    <p><a href="http://www.domain.com/uploads/securefiles/test.jpg">http://www.domain.com/uploads/securefiles/test.jpg</a>

    HTACCESS Code

    deny from all
  • #7 / Jan 10, 2013 10:58am

    Hi, bgarrant!

    I have the same task. Do you have solution?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases