Sei sulla pagina 1di 1

Unit 9.

11
1. Most websites are open to the public.
2. For example, if you run the web site for a club or a school, youll want to restrict
certain areas to members or students only. Or perhaps your site contains
information that has a value, such as documents or pictures, and you need to ensure
that its only viewable to your paying customers.
3.

Because theres a facility built into most web servers. You dont even need to do
any programming.

4. The .htaccess file is used to provide special instructions to a web server. The other
main use for a .htaccess file is password protection.
5. For such purposes, the file needs to look something like this:
AuthType Basic
AuthName "test"
AuthUserFile "/home/thewebbo/.htpasswds/.htpasswd"
require valid-user
6. To start password-protecting your web site, use FileZilla to create a new folder on
the site, within public_html, called private.
7. An .htpasswd file is merely a text file of usernames and passwords, with each pair
on a separate line and with a colon between the usernames and passwords.
8. You encrypt the password in advance, thus the line becomes: open: $apr1$kZy1b/..
$BM8fLekWkKblQ6pynXeM/1 When the user types in their password, the web
server encrypts it and compares it to the version in the .htpasswd file.
9. If you want to use the same set of usernames and passwords for all of the protected
folders, just put a copy of the same .htaccess file in each of the folders, which all
point to the same .htpasswd file. If you want to use different usernames and
passwords, then each protected folder will need its own
10. If you want to use different usernames and passwords, then each protected folder
will need its own

Potrebbero piacerti anche