[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

Password protect a web page

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

thanks!
0
halipe
Asked:
halipe
  • 4
1 Solution
 
jvuzCommented:
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:

me:tz373OcXNjQF.n
someoneelse:aSJeo1t2DvYyg

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.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now