Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

.htaccess and .htpasswd error 401

3:46 am on Dec 19, 2003 (gmt 0)

New User

10+ Year Member

joined:Sept 24, 2003
votes: 0

i want to protect my [subdomain.domain.com...]
directory so uploaded to this directory the files with the ff codes:

.htaccess codes
AuthUserFile /public_html/subdomain/admin/.htpasswd
AuthName "index.php"
AuthType Basic

<Limit GET>
require valid-user

.hpasswd codes (samples only)

but an err 401 appeared. i already checked that i uploaded it in ASCII.what would be the prob.

please help me guys.thank you so much!

12:50 am on Dec 23, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
votes: 0


Somehow, we missed your post.

"401 error" is a misnomer for the 401-Authorization Required response your server sends to a browser to tell it that a username/password authentication is required. If you are getting a username/password prompt followed by a 401 error page or a second user/password prompt, then that means your authentication was rejected. Please tell us more about the exact sequence of errors you see.

I *strongly* recommend that you do not put your .htpasswd file in the same directory you wish to protect. If possible, place it in a directory above the web root of your site. This is a security issue, but may also bear on the problem at hand.


8:17 am on Dec 23, 2003 (gmt 0)

New User

10+ Year Member

joined:Sept 24, 2003
votes: 0

hi there JIM! [jdMorgan]

i want to browse my [subdomain.domain.com...] page, a username/password pop up then i entered the username/password that i have. but i got the error 401 then.
i have the .htaccess and .htpasswd both in the same directory "../public_html/subdomain/admin/ ".

my prob now i cant even open any page from my ".../admin/" directory anymore...it was locked!

do you think i have a mistake with
AuthUserFile /public_html/subdomain/admin/.htpasswd


the codes with .htpasswd?

any help will be appreciated...

9:09 am on Dec 23, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Oct 6, 2003
votes: 0

Strange that you've asked this question I was just trying it a moment ago on my system, but it didnt get to work - the .htaccess I placed in that specific folder did not prompt for anything nor get any errors - strange.
Placed the password auth in the httpd.conf and it worked.

Sorry coming back to your question

-Could your paths be wrong?
-httpasswd doesnt require a . infront of it, but anycase it's not the problem/ & it'll work

And about the password codes, placing it in the same web folder could seriously get yourself h@cked if they are able to guess your password file name. Which I tried just now on my system - I saw the username & encrypted - scary -so might want to change the location file of it.


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members