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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set up htaccess on apache

Status
Not open for further replies.

pho01

Programmer
Mar 17, 2003
218
US
How do I set up .htaccess on apache?

so that the folder is password protected?

Thanks,
 
Hi,

1)Create .htaccess in any folder you want to protect. Example of .htaccess

AuthType Basic
AuthName "Password Protected"
AuthUserFile /usr/local/apache/bin/htpasswd.pass
Require user username1 username2

2) Create password file:

htpasswd -c /usr/local/apache/bin/htpasswd.pass username1

-c option to create new file. To append leave out the -c option. htpasswd file should be in your apache bin directory. Location of this password file is depends by .htaccess file. You can use any filename. Above just for example.

regards,
feroz
 
you run htpasswd from the command line?

Isn't htpasswd.pass encrypted? How do I know what the passwd is?
 
There are slight syntax variations between unix and Windows. What platform are you running? The unix version is demonstrated above. Newposter
"Good judgment comes from experience. Experience comes from bad judgment."
 
Hi,

Of course the password is encrypted. When you type the command, it will prompt for new password.

regards,
feroz
 
I'm running Win2K. I have the .htaccess file in the place, but it didn't pick it up.

This is what I did:
content of the .htaccess file resides in the folder that want to be protected:
---------
AuthUserFile C:\Program Files\Apache Group\Apache2\bin\.htpasswd
AuthName "username"
AuthType Basic

<File *>
<Limit GET>
require user-valid
</Limit>
</Files>
----------
from the command line
C:\Program Files\Apache Group\Apache2\bin>htpasswd -b .htpasswd username password

----------
when I accessed the folder that had .htaccess sits in it, it didn't pop up a login screen or anything.

What's the problem? is there anything that I need to configure in httpd.conf?

Thanks
 
Hi,

Not sure about NT environment, but can you try put <Directory> access in httpd.conf. Within that <Directory> make sure you have line AllowOverwrite AuthConfig. Restart your httpd.

regards,
feroz
 
[tt]AuthUserFile C:\Program Files\Apache Group\Apache2\bin\.htpasswd[/tt]
should read
[tt]AuthUserFile &quot;C:\Program Files\Apache Group\Apache2\bin\.htpasswd&quot;[/tt] //Daniel
 
I cliked on Submit Post before I was done...
It should really read
[tt]AuthUserFile &quot;C:/Program Files/Apache Group/Apache2/bin/.htpasswd&quot;[/tt] //Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top