Home | Products | Downloads | Order Now | Contact us      

   Best Webmaster Software Tools for Website Building!

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

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

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

Protect the web page which 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 how to do that.

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

  • If visitors access the PDF file from the locked web page, that is, if he logs in the locked web page, then clicks link on the web page, downloads or views the PDF file, everything will be fine.
  • If he directly enters the URL web address of PDF file in his web browser, or bookmarked the address of PDF file, and then try to open the bookmarked address again, he will be redirected to the locked web page, and have to login.

There are four steps to do this:

1. Download this ZIP file to your local computer. Download.

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

3. Edit the .htaccess file in this way:

The .htacess file is as follow:

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, you should place it to the same directory as the PDF files.

We have made 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 logs in the web page, then open or download the PDF file, everything will be fine, but if you directly open the link of the pdf file, you will be redirected to the login page.

If you had opened the PDF file online, please clear the caches of your web browser 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
Encrypt HTML Pro
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 2002 - 2007 MTop Software Inc. All Rights Reserved.