PDA

View Full Version : Allow directory viewing?



maida
09-15-2003, 06:59 PM
Is there a way to configure a specific directory and any of its subdirectories so that you can view the directory contents?

Thanks for your time,

Maida

FZ
09-16-2003, 02:57 PM
maida,

Create a file called .htaccess (that's the name - it's just an extension, no actual name) and place the following code in it:


Options +Indexes

Upload it using FTP (in ASCII mode) into the directory you want. You should then be able to list contents of that directory and any sub-directories "under" it.

wizard
10-28-2003, 09:07 AM
Hey maida,

You can do a lot with .htaccess although it's just a simple way Apache has used to prevent users from directly accessing the Apache Config File. As far as i am aware with the new 2.0 System you will be given a virtual server and it would be a better idea to modify everything through the Apache Config file itself.

However, if you like .htaccess these are some of the steps
Create a .htaccess file in the directory you wish to enforce limits on. Use your favourite editor such as vi, pico, nano, ee etc..

Here is an example of what the file can look like. It can have many more lines in it doing various stuff, an example is a custom 404 Page

AuthName "Authorised Users Only - Restricted Area"
AuthType Advanced
AuthUserFile /directory/outside/webroot/.users
require valid-user

To create the .users file or whatever you want to call it...
Type htpasswd -cm passwordfile username
e.g htpasswd -cm .users maida
It will then prompt you for a password... Then you're done, the page will require Authorisation before viewing.

Ok, now lets say you want to add more users. Type htpasswd -m samepasswordfile newuser
The -c prevents it from starting a new file and merely MD5 hash cipher encrypts it and updates the file.

I suggest you keep your users file outside your web folder so that people cant download it, not that it's easy to crack MD5 but one can never be too safe.

Look around on google for Tutorials on .htaccess There are thousands of things one can do with it.

Anyways Gluck with Htaccess

:)
Lemme know if there are any problems.

2fangs
11-08-2003, 09:54 PM
I tried puting the .htaccess file to make my directory list the files and folders in that directory. However, it seems to have a problem with using passwords on that directory. I'm currently on WH1 does that have anything to do with that?

FZ
11-09-2003, 07:32 AM
To password protect directories, you need to use a .htaccess as well. So, it might be that you made the .htaccess allow directory listings, and now that you are trying to use your 1.0 Site Manager to password protect, it can't because a .htaccess already exists. If this is the case, what you should do is remove the .htaccess completely, password protect it using your Site Manager, and then add the line of code that enables directory listing to the .htaccess that is created.