GWI Interactive Self-Help Tool Glossary    Contact Us
Search  
   
Browse by Category
GWI Interactive Self-Help Tool .: Website Hosting .: Business Web Hosting .: How to use .htaccess

How to use .htaccess

.htaccess

.htaccess is the name of a file you can place in your directories to protect them using a password. It can be setup in many different ways. We cannot cover all of the uses of .htaccess in this mini-faq, we suggest that you see NCSA's .htaccess guide for a more in-depth discussion of how to use .htaccess.

Basic .htaccess Use

The first thing you need to do is create an .htaccess file, in the directory you want to protect. If you place this in the root directory of your web site, it protects any other directories inside that root directory as well. The most common way of using .htaccess would be to *setup an .htpasswd file as well, where usernames and passwords are stored.

*Please Note: Shell access has been disabled for customer use. Please contact Technical Support to install .htpasswd file. If you need to change passwords often, we would recommend the installation of a tool like user_manage.cgi to allow you control without having to contact support.

Example .htaccess File

Create a text file called .htaccess, and upload it to the directory you wish to protect. For basic password authentication, the .htaccess file should look like:

AuthUserFile [path_to_password file]
AuthName "Name"
AuthType Basic

<Limit GET>
require user username OR require valid-user OR require group groupname
</Limit>

  • AuthUserFile - This is the full path of where the .htpasswd file is located. For personal websites, we suggest that this file be located in your user directory. For virtual hosting sites, we suggest creating a separate directory for it, and make sure that directory is only world executable (set its permissions to 711). The path for this file will be different depending on the server:

    • Personal Sites: /home/customers/1st letter of username/2nd letter of username/username...
    • Virtual Sites: /usr/local/apache/htdocs/www.yourdomain.com/...

  • AuthName - This is just the name of the Authentication prompt. If it is more than one word in length, it must have double quotes around it.

  • AuthType - Determines how you are using .htaccess. Leave this set to Basic.

  • <Limit ???> - Starts the settings for how and what you are limiting. In the example above, GET indicates that .htaccess is being used to limit who can 'get' information from the website. Inside the Limit tags, you specify how the limiting occurs.
Create an .htpasswd File

Once the .htaccess file is created and in place, you must then call Technical Support at 800-229-2096 to create a password file for it to use.

That's it for basic .htaccess. Once this is all in place, you will get an access prompt when you go to the website. You have to enter a username that is allowed access (set in the .htaccess file) and a password for that username (set in the .htpasswd file). If you have problems, please contact us.


How helpful was this article to you?

User Comments

No comments have been posted.


powered by Lore