Results 1 to 5 of 5
  1. #1

    creating an .httpaccess file

    Hello everyone,

    I'm trying to set up username and password access to a website I am developing. I've never done this before, and I understand that I will need to create an .httpaccess file, but I can't find any information on how to do this anywhere. If someone could point me in the right direction or give me some pointers, I would be very grateful!


  2. #2
    google .htaccess

  3. #3
    Join Date
    Jan 2004
    As Radchenko said it's .htaccess and not .httpaccess.

    First create the file with the passwords:

    htpasswd -cmdps auth UserName

    Then create the .htaccess file:

    AuthType Basic
    AuthName "The Admin Control Panel"
    AuthUserFile /path/www/auth
    require user UserName

  4. #4
    Thanks guys! One more question, though - how do I know what path I should be using for AuthUserFile /path/www/auth?

    My guess would be that it is /path/www/HTML/ross

    ("ross" is the folder I need to password-protect).

    Any thoughts? Do I always use the word "path", or should that be replaced? I've submitted a help ticket to my host, but in the meantime...

  5. #5
    Join Date
    Jun 2004
    Bristol UK
    The advice above is spot on, but assumes you have shell access. Ideally you should login to your server using an SSH client like Putty.

    Once logged into your file system, you need to create a password file. This file holds the list of authorised users and encrypted passwords.

    htpasswd -cmdps auth UserName

    The above is one method, but for a fuller explanation simply type - htpasswd at the prompt and study the options and appropriate syntax.

    You should place the password file in a place not accessible from the web. ie.

    /var/ross/www/public or /home/sites/ are both accessible from the web so place your password file here:

    /var/ross/.htpasswd or /home/sites/

    The .htpasswd file is automatically generated using the htpasswd command. By default the htpasswd file is dropped in the folder where you execute the htpasswd command from the command line.

    Now you have a password file located behind the site root, simply reference it in any number of .htaccess files. By placing a .htaccess file in a folder, it becomes password protected.

    Combining the examples the .htaccess files should look like this:

    AuthType Basic
    AuthName "The Admin Control Panel"
    AuthUserFile /home/sites/
    require user UserName

    If you have any problems, PM me and I will walk you through it.
    If nothing changes - Everything stays the same!

    E-Business Hosting Ltd.
    United Kingdom

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts