Dismal_Nihility Posted November 18, 2008 Share Posted November 18, 2008 i password protected my root, by following lifehackers guide: "Step 3. Password your web site documents. But we don't want just anyone to be able to download your music. Your bandwidth is precious, and we want to secure things a bit. Let's create a password prompt. First, open a command prompt (go to the Start menu, choose Run, then type cmd.) Change to the Apache bin directory by typing: cd "C:\Program Files\Apache Software Foundation\Apache2.2\bin" Then create a password file by typing: htpasswd -c "C:\Documents and Settings\Gina\my_password_file.txt" gina Replace the path with the path of your new password file (which should in any folder EXCEPT the web server's document root.) Replace gina with the username you want to use. When prompted, enter the password you want to set up. Once you've done that, a password file will be created. Now we want to apply that login to your music directory. Open up a new file in a plain text editor like Notepad. Copy and paste the following into it: AuthType Basic AuthName "This is a private area, please log in" AuthUserFile "c:\Documents and Settings\Gina\my_password_file.txt" AuthGroupFile /dev/null <Limit GET POST PUT> require valid-user </Limit> Make sure you replace "C:\Documents and Settings\Gina\my_password_file.txt" in the text with your own password file created above. Save this new file IN YOUR WEB SERVER DOCUMENT ROOT (in this case, C:\Gina\My Music) and name it .htaccess. Don't forget the dot in the beginning, before .htaccess. So, in this case, we're saving the file as C:\Gina\My Music\ .htaccess. Note: If you're using Notepad to create your .htaccess file, when you save the file, put quotes around the filename - ".htaccess" - so that Notepad doesn't automatically put a .txt extension on the file. If there's a .txt file extension, your password won't work! Now, using your web browser, go to http://localhost/. You should be prompted to log in. Enter your username and password you set up in your password file. Rock! " now, i'd like to be asked for a password when accessing directories outside of that passworded directory. how do i do it? Quote Link to comment Share on other sites More sharing options...
corbin Posted November 18, 2008 Share Posted November 18, 2008 <Directory /> AuthType Basic AuthName "This is a private area, please log in" AuthUserFile "c:\Documents and Settings\Gina\my_password_file.txt" AuthGroupFile /dev/null Require valid-user <Directory> Should work. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.