Products > HTML Password Lock
How to password protect PDF, DOC, XLS, PPT, image and other non-web files with HTML Password Lock?

Since HTML Password Lock is file based, it can only protect directly HTML, ASP and PHP web pages. But with some techniques, we can use it to protect Adobe PDF, Microsoft Word, Excel, PowerPoint and image files. This tutorial will take a PDF file as an example.

There are two steps to using HTML Password Lock to protect PDF files on your web server:

Protect the web page that has links to these files. It's very easy to password protect web pages with HTML Password Lock, please refer to http://www.mtopsoft.com/htmllock/help.htm for instructions on how to do that.

If you are using an Apache web server (90% of web servers on Internet are Apache-based), we can use an .htaccess file to limit access to PDF files:

  • If visitors access the PDF file from the locked web page that is, if they login to the locked web page, then clicks on the link to the PDF file to download or view it.
  • But if they try to access the PDF file directly by typing its URL web address on the web browser, or use their bookmarked address to the PDF file, they will be redirected to the locked web page, and be forced to login.

There are four steps to accomplishing this:

1. Click on the link at right to download a ZIP file to your local computer. Download.

2. Unzip it, and open the .htaccess file with Windows Notepad.

3. You will now need to edit the .htaccess file:

The .htacess file reads as follows:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yoursite.com/locked.htm$ [NC]
RewriteRule .*\.(pdf|doc|xls|ppt)$ http://www.yoursite.com/locked.htm [R,L,NC]

You should change the strings in second and third lines "yoursite.com/locked.htm" to the URL web address or your locked page. For example, if the web address of your locked page is http://www.mtopsoft.com/htmllock/pdflocked.htm , that you should change the .htaccess file to:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mtopsoft.com/htmllock/pdflocked.htm$ [NC]
RewriteRule .*\.(pdf|doc|xls|ppt)$ http://www.mtopsoft.com/htmllock/pdflocked.htm [R,L,NC]

4. Upload the modified .htaccess file to your web server, placing it in the same directory where you have stored your PDF files.

We have written an example of this. Please open the locked web page (username: demo, password: demo) http://www.mtopsoft.com/htmllock/pdflocked.htm , in which there is a link to a PDF file: http://www.mtopsoft.com/htmllock/myfiles/test.pdf .

If you login the web page, then open or download the PDF file, everything will be fine. However, if you try to access directly the link to the pdf file, you will be redirected to the login page.

Note: If you have already opened the PDF file online, please clear(empty) your web browser's cache before testing the redirection.

 

Search This Site:

   Advanced

Main

HTML Password Lock
Screenshots
Order Now!
  Download Now

Help

Online Help
Quick Start
FAQ

Online Example

Single Password
Multi-Users/Passwords

Related Products

Search Engine Composer
Web Button Menu Maker

Who likes our products:

Rated 4.5 stars at SnapFiles

Pop at Cnet Download.com

Rated 5 Stars at The File Transit!

 
Home | Download | Order Now | Contact us | Links
ęCopyright Mtopsoft.com All Rights Reserved.