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 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jul 2010
    Location
    Sheffield
    Posts
    824
    Thanks
    93
    Thanked 18 Times in 18 Posts

    .htpasswd / .htaccess not working, throwing 500 or 403 errors

    I'm trying to password protect a one page on my site using htpasswd and htaccess

    heres the files

    .htaccess
    Code:
    AuthUserFile /home/sites/mysite.com/public_html/.htpasswd
    AuthType Basic
    AuthName "My Secret Page"
    
    <Files "mypage.php">
      Require valid-user
    </Files>
    .htpasswd
    Code:
    username:99K2CQ/U.VJ3Q
    When i load any page at on my site using those files i get a 500 Internal server error, however if i load mypage.php using https i get 403 forbidden error. Can anyone see a problem with those files/ know what else could be causing the error?

  • #2
    Super Moderator
    Join Date
    May 2002
    Location
    Perth Australia
    Posts
    4,081
    Thanks
    11
    Thanked 99 Times in 97 Posts
    first off you need to make sure that you don't have

    AllowOverride none in your apache2.conf (or virtual conf file)

    it needs to be at least

    AllowOverride AuthConfig

    & perhaps try
    Code:
    <FilesMatch mypage.php>
    AuthUserFile /user/home/www/directory/.htpasswd
    AuthGroupFile /dev/null
    AuthName "MySecretFile"
    AuthType Basic
    require valid-user
    </FilesMatch>
    resistance is...

    MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)


  •  

    Posting Permissions

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