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

10 replies · 1,281 views · started 19 years ago · 1 min read

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.

2 participants
alesh Lead · 604 posts #1

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

eeeeerrr....

blackhowk Senior · 411 posts #2

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

alesh Lead · 604 posts #3

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....

blackhowk Senior · 411 posts #4

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.

alesh Lead · 604 posts #5

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....

alesh Lead · 604 posts #7

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....

blackhowk Senior · 411 posts #8

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.

alesh Lead · 604 posts #9

okay thanx, now i knw 1 more thng lol

eeeeerrr....

linkrx7 #10

cpanel makes all that code 4 u including the login name and password for the folder protection duno bout other hosts plesk mite dnt reali like that 1 myself worth paying extra 4 cpanel

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close