I wish to allow a dir listing of certain directorys, but I wish to block any downloads.

Essentially the dir structure is

Nzbs -> Alt.binaries.mp3 -> Alt.binaries.tv -> Alt.binaries.multimedia

The files within the sub dirs are .zip files.

I would like customers to have the ability to see the items in the sub dirs, although not allow any installing.

Ive looked the internet but cant find anything relevant.

Thanks ahead of time for just about any help.

You will find a number of ways to get this done

  1. Use RedirectMatch pointed out above
  2. Use mod_rewrite to rewrite each and every call to index.php
  3. Slowly move the folder outdoors document root and show the folder consequently of script work

Options second and third will need you to write a script to list out folder contents. The correct answer is simple script you'll find within the documentation of PHP

<?php
$d = dir("/etc/php5");
echo "Handle: " . $d->handle . "\n";
echo "Path: " . $d->path . "\n";
while (false !== ($entry = $d->read())) {
   echo $entry."\n";
}
$d->close();
?>

The 3rd option will need minimal rights on web server. It really works like this:

  1. Your site is in server folder /home/you/public_html. You set the folder in /home/you/uploads
  2. Client attempting to see folde contents makes its way into the page www.yourdomain.com/folder.php?folder=xxx
  3. You map PHP variable's "folder" value (xxx) to folder title
    • You need to make sure that XX isn't like ../../../etc, this can list the items in etc folder. Either use mapping table (1=>yourfolder1 etc) or make certain everything happens inside uploads folder.
  4. You list the folder records, eventually supplying links to subfolders (www.yourdomain.com/folder.php?folder=yyy etc)
  5. You watch :)

The 3rd option (mod rewrite) is essentially exactly the same, however the folder title is offered through the mod rewrite module (rewrite rule to transform www.yourdomain.com/uploads/xxx to www.yourdomain.com/folder.php?folder=xxx)

Summing up:

The very first option disallows installing file names by redirecting these to some file (like yourdomain.com/403.php). It depends on web server to show your opportunity and allows him handle the relaxation.

Second and third method (may be combined ofc) produces its very own directory listing. If you would like some layout to become used in it, this is actually the only option. The recommended strategy is to put folder outdoors document root, therefore the customers won't have the ability to download any files even when your script fails (for that web server, there will not be such files, because they are outdoors document root). You need to make certain the user isn't permitted to show ANY folder in your server (this really is harmful).

Make use of the RedirectMatch statement to bar the acces to the dir or file that suits the regex and send it to some certain url. It's most likely better to send these to the url they are presently browsing.

RedirectMatch regex url