Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

How to you make an iNdex?

Options
  • 21-01-2002 10:44pm
    #1
    Registered Users Posts: 2,651 ✭✭✭


    Hey how do you make a page that shows a file directory on a webpage? I used to get one when i had a page on geocities if i deleted the main index.html or that. But have stuff on compsoc.com and if i try that i get that 404? invalid url page.

    Thx,
    Gideon.


Comments

  • Registered Users Posts: 6,265 ✭✭✭MiCr0


    you need directory browsing enabled
    what file system are you using?


  • Registered Users Posts: 2,651 ✭✭✭Spunog UIE


    file system!? not exactly sure what ya mean or i dunno what it is.

    Its on a Linux server... command promt on it is:
    Red Hat Linux release 6.1
    Kernel 2.2.14 on an i686.

    I don't think thats what you wanna know?


  • Registered Users Posts: 1,031 ✭✭✭buddy


    Never heard of someone wanting to do that - on some servers if their is no index page it reverts to showing a file directory - which sucks if you don't want people knowing every file you have.

    So, to prevent this in every folder you have to insert an index.html file as you mention.

    With this, some beter servers don't do this as with compsoc.com.

    I doubt they will be able to give this to you as an option - so if you really need you'll have to make a webpage for that purpose!!

    Why do u need it???


  • Registered Users Posts: 2,651 ✭✭✭Spunog UIE


    Cos i always use the compsoc connection to download stuff to my space through telnet and then get it from there or if my friends want it or are in college they can get it on a faster connection, It just be very handy rather than having to update a webpage over and over again with the new files downloaded and what size they are etc' (and there usually is a lot of them).


  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    Getting a 404 strikes me as a bit odd, are you sure you're not getting another error? Anyway, it seems compsoc have Indexes turned off. You can try the following, but I doubt it will work:

    Create a file called '.htaccess' in the root of your website, and put the following in it:
    Options +Indexes
    

    One of three things will happen: nothing, a 500 error, or indexes. If you get one of the former two, just delete the .htaccess file. If you get the latter, well, you're oxo. Here's the relevant Apache docs:

    http://httpd.apache.org/docs/mod/core.html#options
    http://httpd.apache.org/docs-2.0/mod/mod_autoindex.html

    adam


  • Advertisement
  • Registered Users Posts: 258 ✭✭peterd


    OK, I can't take the credit for this one, lifted straight from a book :D This perl script *should* do the trick...
    #!/usr/bin/perl -w

    print "Content-type:text/html\n\n";

    $dir = ".";

    opendir( LOGDIR, $dir ) || print "Oh No, this isn't going to plan\n";
    @logfiles = readdir(LOGDIR);
    closedir(LOGDIR);

    if (@logfiles) {
    print "Here's your directory details...\n";
    foreach $file(@logfiles) {
    print "<LI>$file" unless ( $file =~ /^\.+$/ );
    }
    } else {
    print "This is an empty directory\n";
    }

    # by peter


    - Copy+Paste into text editor and save as
    dirinfo.pl
    - Upload to cgi-bin and chmod 755
    - run the script in your browser (i.e. www.mydomain.com/cgi-bin/dirinfo.pl )

    this will show all the files/folders in your cgi-bin. If you want to list all the files in your www.mydomain.com/private/ directory, just change the line $dir = "."; to $dir = "../private";


Advertisement