Jump to content

password protect aliases? can it be done?


Dismal_Nihility

Recommended Posts

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.