LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   basic html question - download link to files on my webpage question (http://www.linuxquestions.org/questions/linux-server-73/basic-html-question-download-link-to-files-on-my-webpage-question-777628/)

Davno 12-23-2009 02:10 AM

basic html question - download link to files on my webpage question
 
Hi,
I have a small LAMP server, used mostly for family and friends. The web pages are very basic (built with Kompozer). I have thumbnails that link to pictures and files.
But i can not find a way to make the full content of a directory downloadable, except by making html link to each of the files, one by one. This task would take too long, is there a way to do this automaticaly for all the files in a folder. I have a script that make a html list of the content of each of my var/www/html/my_stuff_directory, it would be nice if every line of that list would be clickable and point to the actual file.
Thank you in advance for your help.

baltho 12-23-2009 02:32 AM

The short answer would be to use apache's mod-autoindex, which does just what you want - if there's not an index.<whatever> in a directory, it'll just produce a list of the files there.

If the module's not enabled, do "a2enmod autoindex" as root/sudo and restart your apache. You can also fine-tune it by allowing (or not) auto-indexing on specific folders in your web site.

Davno 12-23-2009 02:41 AM

Thank you for the quick answer, first thing ill try when i get home. :)

Davno 12-25-2009 01:15 AM

Hi, maybe you can help me again.
I have checked if the module is enable in the httpd.conf and it look ok
Code:

LoadModule autoindex_module modules/mod_autoindex.so
my problem is that i probably configure it wrong, see what i added to httpd.conf
Code:

<Directory "/var/www/html/stuff">
    Options -Indexes MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

I restarted the server and still no indexing is found in there.
If i create a index.html file in that repertory, it stays empty and if i don't create one, it is simply not being created. :(

sleddog 12-25-2009 06:24 AM

Try:

Code:

<Directory "/var/www/html/stuff">
    Options +Indexes +MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
</Directory>

Delete any index.htm or index.html file that you created. They will prevent Apache from generating the directory listing.

Then browse to the directory, like: http://mysite.com/stuff/

Davno 12-25-2009 07:24 AM

The + and - signs, that was it thanks.


All times are GMT -5. The time now is 06:55 PM.