Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

.htaccess & .htpasswd

Status
Not open for further replies.

tjbradford

Technical User
Dec 14, 2007
229
GB
hi all i have bought some hosting to dabble with and have discovered that my hoster 123-reg allow the use of .htaccess and .htpasswd , cool right i created the files as follows

.htaccess
---------
AuthName "Password Protected Directory"
AuthType Basic
AuthUserFile /secure/.htpasswd
require valid-user

.htpasswd
---------
login:1$2C8rxmPUWt2 (login:please)

I have got a website eg.
if i add the .htaccess to the location
and add the .htpasswd to
i get prompted to authenticate when however it just keep repeating the same prompt and never accepts my details why is this ?

also i would rather the .htpasswd went inside /home but would that mean i dont have permissions to authenticate then?

i'm really stuck with this one

btw i only have ftp access no shell prompt access :(
 
I believe starting with '/', it can only be the full path name. Without a beginning '/' it is appended to the ServerRoot value.

There is no way to append to the DocumentRoot.

So either put the htpasswd in ServerRoot, or figure out the full path name.
 
what about if there in the same folder

ie i place both files in a folder called secure
and in the .htaccess file i use AuthUserFile .htpasswd
should that work?
 
Don't thinks so. That would be .htpasswd in the server root.
This is a security "feature" so users can't (easily) download the htpasswd. I must admit I use the full path for testing.

Somewhere (in your web documentation) there has to be mention of ServerRoot location or how the full path is determined.
 
sorted , as expected it required the full root path , after speaking to my hosting they gave me the full path and it now works great

so for anyone who use's 123-reg as there hosting

AuthUserFile /home/vhosts/(your ftp username)/.htpasswd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top