How 2 Protect A Folder On Ur Server With .htaccess File
Started on the old forum in July 2007 · view the original in the archive · old links redirect here
TL;DR · summary of 10 replies
- - .htaccess file is used to set up authentication for a folder, while .htpasswd contains the usernames and passwords.
- - The .htpasswd file needs to be placed in the same directory as the .htaccess file or within its parent directories if using recursive protection.
- - The security of files protected with this method depends on the strength of the username and password combination used for .htpasswd, not on whether it's better than what a hosting provider offers.
- - Using custom methods like .htaccess is as secure as any other method provided by a hosting service that supports such features.
Written automatically from the replies by a language model on our own server. It can be wrong; the posts below are the source.
i run on sum .htaccess file and when i put it in sum folder it ask me username and password when i wanna enter with any browser......
how cn i set tht username and password????
i mean i wanna protect a folder but i wanna come in with any browser
hello,
you may use this: first create .htaccess file :
AuthUserFile /home/USER/.htpasswds/.htpasswd // path to .htpasswd - ABSOLUTE PATH! AuthGroupFile /dev/null AuthName "Access to Level One Area" AuthType "Basic"
<Limit GET POST>
require valid-user
</Limit>
second create .htpasswd file:
guest:T.U4Jxh4O8ElY
#guest dream
you may need to write the absolute path in .htaccess to .htpasswd , also .htpasswd contain username and (optional) password hint only for webmaster.
in my example user is: guest and password is: dream.
make a new user and password here: http://www.kxs.net/support/htaccess_pw.html or search with google : htaccess password generator
thank u, but i dnt understad it all....
i understand the 1st part with .htaccess file
but i dnt understand the 2nd part with .htpasswd
when i create .htpasswd , where should i put it???
UGH OKAY I FOUND IT NOW!!!!!!! LOL I SHOULD SEARCH 1ST NEXT TIME..... IT LOOKS SO SIMPLE.....
STILL GOTTA TRY IT
eeeeerrr....
ok, you create 2 files. .htaccess and .htpasswd
now, you may put .htpasswd and .htaccess in the same director , and this protect only the director; you may put .htpasswd in your director to protect and .htpasswd in includes, root or recursive but in al cases you need to write the correct path in .htaccess to .htpasswd.
ok, you create 2 files. .htaccess and .htpasswd
now, you may put .htpasswd and .htaccess in the same director , and this protect only the director; you may put .htpasswd in your director to protect and .htpasswd in includes, root or recursive but in al cases you need to write the correct path in .htaccess to .htpasswd.
yes i understand it now! thank u!
1 last question.... HOW SAFE IS IT??? I MEAN HOW SAFE R FILES IN THAT FOLDER WHEN I PROTECT IT LIKE U EXPLAINED??
eeeeerrr....
is the best method and cannot be override.
okay, is it better than tht which host offers, sum link tht u cn manage protection of folders???
i mean its almoust the same (when u enter it asks u a username nd password) but its without .htaccess file....
Which one solution is better?
eeeeerrr....
its the same method, but the host protect dirs must be enabled from cpanel or else; when the host dont have this option you make this custom protection for dirs. when u use all day one ftp the choice is custom, i think.