Results 1 to 5 of 5

Thread: Ca some give me advice about .htpasswd

  1. #1
    Join Date
    Jan 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Ca some give me advice about .htpasswd

    Can someone please help me with how to .htaccess and .htpasswd my website.PLEASE HELP

  2. #2
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Yup. It seems complicated at first but is really fairly simple. Here is a basic method for password protecting a folder on your site:

    open notepad (or other plain text editor) and type this (no extra spaces each on it's own line:

    Code:
    # Begin password protection #
    AuthName "This is the Realm"
    Require valid-user
    AuthUserFile /home/usr/public_html/path/to/root/.htpasswd
    AuthType basic
    # End password protection #
    Then choose file>>save as..

    When the box appears type in the name .htaccess don't forget the "dot" at the front.
    In the drop down box (just below where you enter the file name) select "all file types" this way ".txt" will NOT be added to the name. then save it.

    Now you need an encoder. There are several around the web. The two best are found atB&T's Tips and Scripts in the right menu bar (you will see a spot to enter a username and password, enter them and click encrypt), a pop up will appear with the hash in is, copy it and paste it into a new notepad document.

    Or the one right here at DD Passwords Same basic steps here.

    you will have a code like:

    Code:
    user:$1$PGbCQieL$hbvRHw2fWUtZjb7xgl1uM1
    save this the same way as before but as .htpasswd

    then upload the .htaccess to the folder you want to protect, and the .htpasswd to your root folder (or somewhere you choose - they can be the same folder, but this isn't recommended).

    that's it. A few notes:

    in passwd, the username is never encrypted, the colon is always following the username (user: ) the password is encrypted in a non-reversible hash, meaning if you forget the password, you can not ever recover it.

    for access:

    Next to AuthName what ever is in quotes is what will appear on the box. the "Realm" You can leave it empty ( "" ) or have it say anything you want, like "Please enter your user name and password"

    The path next to AuthUserFile is the relative path to the folder that houses the passwd file. public_html may be called root on your server, etc. just make sure it all points to the passwd file and you are set.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  3. #3
    Join Date
    Jan 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks. It seems that when i load these files it password protects my whole site which is not what I want. I have never written scripts or any thing before for a website. When I uploaded the site I did so to public_html folder.I dont realley understand what i am doing .Maybe you could help further. Would you be willing to log in via ftp to have a look and further advise?????

  4. #4
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    The file will password protect the folder it is in, and any that are below it.

    If it is protecting your entire site is is outside the public_html folder, and needs to be moved INSIDE the public_html folder

    I can do that for you, but we would help more people (and you wouldn't have to give out FTP info) by keeping it in here.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  5. #5
    Join Date
    Jan 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I av forwarded details of ftp login to you via email.
    regards jon

Bookmarks

Posting Permissions

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