welsh-wizard

Member
Jan 2, 2003
9
0
151
I am having great difficulty in finding out how to password certain pages on my website.

Could someone please offer advice on how to do this in plain English for us newbies(ish) to have a go?

Sorry to be a pain.

Thanks.

PS I don't want to password the ENTIRE site ! (just certain pages of it)
 

iain-pczap.net

Active Member
Dec 27, 2002
32
0
156
to password protect some pages the most simple way is via .htacess

open up notepad and paste in an edit of this
&AuthType Basic
AuthName &The description you want to appear&
AuthUserFile /home/$username/.htpasswds/$dirname/passwd

require valid-user
&
once thats in ur notepad you must name the file &.htaccess& and choose 'all files' from the file type.
Be sure to include the &s in the filename.

Then upload this into the directory you wish to protect.

I'm not sure but you may be able to protect the main directory public_html by removing &$dirname/&.

So basically the $username will be the username required to access cpanel, and $dirname would be the name of the directory you wish to protect.

Obviously once u login for one protected file in a directory it keeps the login info until u close the browser so you can access more protected files without logging in again.

Im unsure how to protect individual files using this method.

Hope thats helpful.
 

welsh-wizard

Member
Jan 2, 2003
9
0
151
thanks for answering.

Can you be a little more specific about what i need to replace with what

eg.

&AuthType Basic
AuthName &The description you want to appear&
AuthUserFile /home/$username/.htpasswds/$dirname/passwd

require valid-user
&

(that means VERY little to me)

replace &$username& with the username you want to use

where does the &home& directory come from - I don't have one !

If I have a directory called &Limited&
and I only want a user called &Company&
with the password &help&
...

how would I create the .htaccess file?