How to close the page the password

How to close the page the password

Digital Hits: 89

If your website, as well as the majority of websites in network, is placed on the Apache server, then to close the easiest way the password a part of its pages - to use the authorization mechanism which is built in this server via the htaccess file. In this case you should not make any changes to initial codes of pages and knowledge of any programming languages too it is not obligatory.

Instruction

1. Move pages which are required to be password-protected, to the separate folder on the server. If the system of authorization should work for all pages website, then this step is not necessary.

2. Create the office htaccess file. It is the normal text file therefore for work with it it is possible to use any text editor. In it it is necessary to write directives for the server software: AuthType Basic
AuthName ""Access to These Pages Requires Authorizations!"
AuthUserFile/usr/yourAccount/yourSite/.htpasswd
require of a valid-userdirectiv AuthType Basic in the first line activates the basic mechanism of authorization. "Basic" it is called because the password entered by the visitor in this case is transferred from the browser to the server encrypted on algorithm Base64. The following directive (AuthName) contains the text which will be seen by the visitor on an authorization form. You can replace it with another. The directive AuthUserFile specifies a full path to the file in which logins and passwords of users will be stored. The last directive (AuthUserFile) defines the principle of authentication. The Valid-user value means that users whose logins are written in the file specified in the directive AuthUserFile can be allowed to the password-protected pages.

3. Save the file with directives under the name of .htaccess - pay attention that it has no name, and there is only an expansion.

4. Create the file with the list of logins and passwords for access to secure pages. For this purpose it is necessary to use the htpasswd.exe utility from structure of the software of the Apache server. It is possible to download it, for example, here - http://www.intrex.net/techsupp/htpasswd.exe. It works in the command line therefore you should start at first the terminal - to click the keyboard shortcut WIN + R, to enter the cmd command and to click the ENTER key.

5. Gather in the command line: htpasswd - cm .htpasswd UserOneZdes the modifier - cm specifies to the utility that it is necessary to create the new file and to use MD5 algorithm for encryption. If to replace m in the modifier with d, DES encryption algorithm will be involved if s - SHA algorithm, and modifier p turns off encryption of the password.UserOne - it is the user login, enter instead of it the login necessary to you. After you click the ENTER key, the utility will ask to enter the password for this user. If it is necessary to add the following user, then restart the utility, but do not use a letter of ""c"" in the modifier.

6. Place the created .htaccess and .htpasswd files on the server of your website. The .htaccess file should be saved in the same directory where the password-protected pages lie, and the .htpasswd file - to place in that place to which full path is specified in the directive AuthUserFile.

Author: «MirrorInfo» Dream Team

Print