Password protect a  web page

Posted on 2007-10-03
Last Modified: 2013-12-25
Is there a way to password protect a file on a web page? I have a site I'm working on and the client would like to have a link to an internal directory; however, they would like it to be password protected (the link is within a page with other information) Please let me know if there is a way to do this.

I'm working on the site on a macbook pro using adobe GoLive

Question by:halipe
    LVL 22

    Accepted Solution

    LVL 22

    Expert Comment

    LVL 22

    Expert Comment

    LVL 22

    Expert Comment

    How do I secure a Page?
    Let's say you want to restrict access to the directory called "/home/me/public_html/secret/" to just a small group of people. Then you need to create two files:

        * /home/me/public_html/secret/.htaccess - which details the access restrictions for that directory
        * .htpasswd - has the username and password details. It doesn't need to be in the same directory

    Here's a sample .htaccess file:

    AuthUserFile /home/me/public_html/.htpasswd
    AuthName "Access to Private Web Pages"
    AuthType Basic

    require valid-user

    Note that the .htaccess file needs to be readable by the webserver for it to work. You should set its permissions to 644 (ie. chmod 644 .htaccess).

    You need to create the .htpasswd file, which just contains a username and crypt'd password separated by a ':' on each line, eg:


    This can be created on any CSE linux machine, like this:

    htpasswd -c /home/me/public_html/.htpasswd  me

    Which will then prompt you for the password for "me" and add the entry to the .htpasswd file. Run "man htpasswd" for more details.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Accessibility and Usability are two concepts that seem to be closely related.  But, too many people seem to have a distorted perception of them. During last five years, those two words have come to the day-to-day work of almost every web develope…
    I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
    The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: : Go t…
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    26 Experts available now in Live!

    Get 1:1 Help Now