Protecting Files

Section I: Protecting Files Under WordPress

This is the fastest, easiest way to protect files. And this is what is highly recommended.

1) Upload them to your WordPress blog when you are writing a new post. All such files will be stored in a folder called “wp-content/uploads/….“.

For large files, you could simply upload them directly using FTP, directly into the “wp-content/uploads/” folder and DAP is configured right off-the-shelf to “look” for any file inside the “wp-content/uploads/” folder. But once the file is under the “wp-content/uploads/…” folder (either directly under it, or under a sub-folder, like wp-content/uploads/videos/), you will now still need to let DAP know that this file is to be protected as part of a Product.

NOTE: You DO NOT have to upload files using the WP file uploader (like some of our competitors force you to do!). You can use regular, plain ol’ FTP, using a client like FileZilla or CuteFTP, or your webhost cPanel’s FTP feature.

2) Go to the product you wish to protect the file as part of, and then scroll down to the “ContentResponder” section.

2.1) If you know (or can figure out) the full URL to your file – like http://www.YourSite.com/wp-content/uploads/coolreport.pdf - you can simply paste that directly into the field “A” (in the image below)

2.2) Or, if you can’t figure out the full URL, then you can enter “wp-content” (if your blog is directly in your root folder) – or “blog” or “members” (if your blog is not in your root, and is in a sub-folder) into field “B” below, and then click on “Load Files”, and it will show you all files under that folder. And you will be able to scroll through and look for your file. And there click on the “Add” link right next to that file name you wish to protect.

Once you do (2.1) or (2.2) above, the file will get added to the Product, and will now be protected.

Section 2: Protecting Files Outside of WordPress

There is a simple, one-time setup involved if you want to protect files outside of your WordPress directory.

1. You need to add the following code to the .htaccess in the root of your web site. So, in your web site’s root folder (where you have your home page – like index.php or index.html for example)…

i) if you already have an existing .htaccess file there, then just open it, COPY the text from below and PASTE it at the very end of this file.

ii) If there is no .htaccess in your root folder, then create one, and then open it, COPY the text from below and PASTE it at the very end of this file.


NOTE: BE SURE TO MAKE A BACK-UP OF YOUR EXISTING .htaccess FILE FIRST

#Paste this at the very end of your .htaccess file
#in your web site's root folder

<IfModule mod_rewrite.c>
#dap
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !dapclient.php
RewriteCond %{REQUEST_URI} !^/dap/
RewriteCond %{REQUEST_FILENAME} !(.*)(\.php|\.css|\.js|\.jpg|\.gif|\.png|\.txt)$
RewriteRule (.*) /dap/client/website/dapclient.php?dapref=/$1&plug=wp&%{QUERY_STRING}  [L]
</IfModule>

 

Doing the above enables file protection for files outside your WordPress installation folders.

2) Now go to the DAP Product you wish to protect the file as part of, and then scroll down to the “ContentResponder” section. Then…

  • If you know the full URL to your file – like http://www.YourSite.com/reports/coolreport.pdf – you could simply paste that directly into the field “A” from the image above (make sure you “visit” this URL first and verify that there is actually such a file at this link)
  • OR… if you can’t figure out the full URL, then you can enter the text “reports” (the name of your top-level folder where your file is) into field “B” from the image above, and then click on “Load Files”, and it will show you all files under that folder. And you will be able to scroll through and look for your file. And there click on the “Add” link right next to that file name you wish to protect.

The file is then added to the Product, and will now be protected as part of that Product.

That’s it.

Testing File Protection

Open a different browser (not different window – a totally different browser – like, if you’re logged in as DAP admin in FireFox, then open IE)  and try to access your file directly and see if DAP redirects you to the login screen.

If not, take a deep breath – it’s NOT DAP :-)

It’s just that you probably missed something during the setup.

Revisit the steps above, and if you still can’t figure it out, you might want to think about uploading the file to wordpress (see Section I above) .

If you need help, then just open a support ticket with as many details as possible, and we’re standing by to help you.

Recommended Reading

If you have a number of large files to deliver to your members, then you should consider hosting your files on Amazon S3. And here’s why…

16 comments ↓

#1 Julie on 04.19.10 at 2:08 am

Hi. Will this also work if the folder/files you want to protect is a subfolder of the root?

For example in the root is a folder called “protect” I want all files and pages within this folder protected, but not any other pages/files in the root itself

I tried to add the .htaccess file inside the “protect” folder, but that didn’t work.

I am doing this right, or will it not work for sub folders?

#2 Ravi Jayagopal on 04.29.10 at 1:17 am

Julie,

>>Will this also work if the folder/files you want to protect is a subfolder of the root?<<
Yes, absolutely. You just have to add a few lines of code to your .htaccess file in the root.

If you already have dap, then just open the file dap/client/website/.htaccess – and copy the entire .htaccess into your root folder. Or if you already have a .htaccess in the root folder, then simply copy-paste the contents of the DAP .htaccess file mentioned previously, at the end of the .htaccess file in your root folder.

#3 jerome on 05.19.10 at 11:01 am

@Ravi >>Will this also work if the folder/files you want to protect is a subfolder of the root?<<
Yes, absolutely. You just have to add a few lines of code to your .htaccess file in the root.

What would that line be?
thank you

#4 Ravi Jayagopal on 05.21.10 at 11:05 am

See the .htaccess file in /dap/client/website/

#5 Sarah on 07.13.10 at 1:14 pm

Can you add a single blog post to multiple products or would I need to create a new post for each product?

#6 Kevin on 09.02.10 at 3:32 pm

Ravi,

It would be nice if you would replace the batteries in your smoke alarm before making videos. I looked all around the house for the smoke alarm with a weak battery and couldn’t find it, so I gave up. But, I kept hearing the beep, so I rewound the “Creating a Product” video and there it was — the beep.

Have a great day ;)

-Kevin

#7 Ravi Jayagopal on 09.02.10 at 3:54 pm

Haha… sounds good. Yeah, have heard that before from a couple of “keen listeners” :-)

That won’t be a problem any more – we’ve moved to a new house, in a completely new city (moved a few weeks ago from NY to San Diego, CA) :-)

#8 Edit on 10.28.10 at 8:34 am

This section is about “Protecting Files Under WordPress”.

But I have one more question: How can I create something like a “download gallery” for my protected files?

I want to have a members page in WP where the members can download many files e.g. PDFs, Audios, Videos, etc.

I found a nice little WP plugin called “WP-DownloadManager” which does exactly what I want. But it seems that it doesn’t work together with DAP.

Thanks,
-Edit

#9 Ravi Jayagopal on 10.28.10 at 12:22 pm

Please see further down on this same post – there’s another section called “Section 2: Protecting Files Outside of WordPress”.

If you are protecting files using DAP, you should not (and need not) try to use any other download protector, as DAP already takes care of that for you.

#10 Edit on 10.28.10 at 1:00 pm

Sorry, I didn’t write my question clearly enough.

I’m not talking about protecting the files, I’m talking about how I can create a “download gallery” for my already by DAP protected files.

I don’t want to use any other download protector. Just want to know how I can provide a nice download page.

Maybe it’s easy but I’m not very versed with WP.

#11 Veena Prashanth on 10.28.10 at 1:14 pm

To create a gallery, you have to hand-code the images (like thumbnails of PDF file, video, audio etc) to make them look pretty, and link them up to the protected files, and DAP will take care of protecting them in case they get passed around. DAP by itself will not give you a gallery-like download page for your files.

But DAP does already provide you with the “My Links” page, but that page just lists all of your content – does not have images and thumbnails, etc.

#12 Edit on 10.28.10 at 1:34 pm

Hi Veena,

thanks for your quick answer.

Please excuse my bad english. Maybe the word “gallery” was misleading. I didn’t want to have a gallery with thumbnails (even though WP-DownloadManager provides something like that). I just need a links page with all the downloads.

Maybe the “My Links” page provided by DAP is the right one. Unfortunately I didn’t find it in the documentation. Could you please give me a link to it?

Thanks.

#13 Veena Prashanth on 01.22.11 at 10:38 am

>> Maybe the “My Links” page provided by DAP is the right one. Unfortunately I didn’t find it in the documentation. Could you please give me a link to it? < <

http://www.digitalaccesspass.com/doc/creating-member-affiliate-sections-within-wordpress/

#14 Adam on 02.13.11 at 6:18 am

Hi,

I tried to find everywhere in DAP Blog and Forum about possibility to protect and set time for download links, something like DLGuard. Is it possible to set link expiration in DAP?

#15 Allan on 02.03.12 at 7:30 pm

Hello,

Can DAP protect downloads if the downloads are in a folder outside the public html folder (directly in the web root)?

Thanks.

#16 Veena Prashanth on 02.05.12 at 9:31 pm

As long as it’s in the same domain as dap, dap can protect content. Protect the full url in dap contentresponder section and add the following to .htaccess file in that folder (create .htaccess if it does not already exist).


#dap
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !dapclient.php
RewriteCond %{REQUEST_URI} !^/dap/
RewriteCond %{REQUEST_FILENAME} !(.*)(\.php|\.css|\.js|\.jpg|\.gif|\.png|\.txt)$
RewriteRule (.*) /dap/client/website/dapclient.php?dapref=/$1&plug=wp&%{QUERY_STRING} [L]

Leave a Comment