Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: .htpasswd issue

  1. #1
    Senior Coder nikos101's Avatar
    Join Date
    Dec 2006
    Location
    London
    Posts
    1,005
    Thanks
    58
    Thanked 10 Times in 10 Posts

    Question .htpasswd issue

    Hi I have a site locally at

    C:\xampp\htdocs\cms\

    I have a .htpasswd file at C:\xampp\password\
    the .htpasswd file contains wsabstract:y4E7Ep8e7EYV

    My .htaccess code is stored at

    C:\xampp\htdocs\cms\

    and contains

    Code:
    Options -Indexes 
    DirectoryIndex index2.php
    AuthName "Section Name"
    AuthType Basic
    AuthUserFile C:/xampp/password/.htpasswd
    Require valid-user
    when I go to http://localhost/cms/ I get an error 500 instead of a password prompt.

    Any advice?


  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    The password can't be encrypted if you are running xampp on windows. Everything else looks fine though. Try this
    htaccess
    Code:
    AuthName "Section Name"
    AuthType Basic
    AuthUserFile C:/xampp/password/.htpasswd
    Require valid-user
    Options -Indexes 
    DirectoryIndex index2.php
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • Users who have thanked _Aerospace_Eng_ for this post:

    nikos101 (11-19-2007)

  • #3
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,852
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Quote Originally Posted by _Aerospace_Eng_ View Post
    The password can't be encrypted if you are running xampp on windows. Everything else looks fine though. Try this
    htaccess
    xampplite\apache\bin\htpasswd.exe creates an encrypted password.

    I've done this in windows, but missed the tutorial link. Anyway I think the steps are as follows.
    0)Backup your xampplite\apache\conf\httpd.conf
    1) Add the below portion in to this
    Code:
    AccessFileName .htaccess
    <Directory "/xampplite/htdocs/myfolder/admin">
        AllowOverride All
          Options None
          Order deny,allow
       </Directory>
    under a line DocumentRoot "/xampplite/htdocs"
    2) Take command promt and run
    Code:
    xampplite\apache\bin\htpasswd.exe -c .htpasswd username
    this will create a .htpasswd file in your working directory.
    3)Copy this file to htdocs/myfolder/admin
    4)then create a .htaccess file in your folder to be protected having something like
    Code:
    AuthUserFile C:/xampplite/htdocs/myfolder/admin/.htpasswd
    AuthName "This is protected area"
    AuthType Basic
    <Limit GET POST>
    require valid-user
    </Limit>
    (Change folder name to fit to your system)
    5)Restart apache.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    nikos101 (11-19-2007)

  • #4
    Senior Coder nikos101's Avatar
    Join Date
    Dec 2006
    Location
    London
    Posts
    1,005
    Thanks
    58
    Thanked 10 Times in 10 Posts
    Well done Aero, that worked nicely, although I'm not sure why it made a difference.

    Also thanks to abduraooft where your post could really help me in the future.



  •  

    Posting Permissions

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