YEAR 2000 CERTIFIED

 

Web Hosting
Dedicated Servers
Our Network
References
Online SupportOrder Online
Contact UsQuestion and Answer

 

 

 

 

 

ChinaWebHelp internet services

中国企业走向国际需要自己的网站
我们是您的忠实助手

How to Password Protect A Directory

What is .htaccess?

Important Note: Do not edit the .htaccess file if you are using MS Frontpage! Frontpage uses the .htaccess file, and editing it may cause errors in your configuration.

First you want to create a .htaccess file in the directory that you want to protect.  Moreover, the .htaccess file can be placed in one or more of your /home/username/domainname-www subdirectories. Among other things, this file can be used to restrict access to other files and web pages.

When a request for a web page is made, the web server first checks for an .htaccess file. The server begins this check by looking for .htaccess in the root of the current web directory, and on down the directory tree until it reaches the the directory where the requested file resides. Since the placement of the .htaccess file determines when it is executed, this fact can be used to restrict access only in certain subdirectories.

Restricting Access: Password Protection

The directory you want protected must have an .htaccess file in it that looks like the following:

AuthUserFile /home/username/.passwd
AuthGroupFile /home/username/.group
AuthName "Access by password Only"
AuthType Basic
<Limit GET POST>
require group groupname
require user username
</Limit>

Groups and users are stored in the .group file, and passwords are stored in .passwd. The .htaccess file looks for .these files in the /home/username/ directory. Do not attempt to edit these manually! Netquest has a special script you can use to manage your .group and .passwd files (the "webmister" script).

 

Redirects

Redirecting allows you to send the user to, for example, new.html when they attempt to access old.html. To see this example in practice, simply add the following line (This should be typed as one single line without breaks) to the .htaccess file:

Redirect /directoryname/old.html http://yourdomainname/directoryname/new.html

Apache has a nice FAQ on redirects.

Second you need to Email us to have the webmister program installed on your domain.  The webmister program is an online web-based application that manages the usernames and passwords for your .htaccess files.

 

Order | Hosting | Dedicated | Network | References | Support | Contact
Email us | Acceptable Use Policy