Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-20-2012, 09:49 AM   PM User | #1
tomharto
Regular Coder

 
Join Date: Jul 2010
Location: Sheffield
Posts: 794
Thanks: 91
Thanked 18 Times in 18 Posts
tomharto is on a distinguished road
.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?
tomharto is offline   Reply With Quote
Old 06-21-2012, 10:50 AM   PM User | #2
firepages
Super Moderator


 
Join Date: May 2002
Location: Perth Australia
Posts: 3,896
Thanks: 5
Thanked 79 Times in 78 Posts
firepages will become famous soon enough
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)
firepages is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:09 PM.


Advertisement
Log in to turn off these ads.