[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: index.html




On 04/30/2017 08:26 PM, Gene Heskett wrote:
Greetings;

Imagine my surprise when I looked at /var/www/html/index.html,
and found that somehow, it was native to a PCLos install I was running
half a decade or more ago!

Now, do we have a script that will rebuild a new index.html for the
defined root of the server, and which WILL access the /var/www/html/gene
directory? This should restore the whole site to http compatibility.

Right now, with out without that file, the subdir "gene" isn't
accessible.  Cannot be found is the message.

Cheers, Gene Heskett


nope. You've got to write or create your own index, unless you install something that generates one, such as dokuwiki, or wordpress, or any of a myriad of other CMS, (micro)blogging, social networking, or wiki platforms, forums or gallerys...the possibilities are nearly endless.

If you just want to list the directories contents, try putting in an index.php with something like this in it:

<html>
<body>
<ul>
<?php
   // loop through files and list them

   $path = "/var/www/html/gene/";

   $dir_handle = @opendir($path) or die("Unable to open $path");

   while ($file = readdir($dir_handle)) {

if($file == "." || $file == ".." || $file == "index.php" || $file == "private" || $file == ".htaccess" || $file == "robots.txt" || $file == ".index.php.swp" )

                 continue;

         echo "<li><a href=\"$file\">$file</a></li>";

 }

 closedir($dir_handle);
?>
</ul>
</body>
</html>


You'll have to have php5 or better installed.
This is essentially how I built http://tonybaldwin.me/pages/
and various other pages on my site, including
http://tonybaldwin.me/images/
 only that has
 $path = "/path/to/www/images/";

....
<p><a href=\"$file\" target=\"_new\"><img src=\"$file\" style=\"max-width:200px;\"><br />$file</a> because that dir is full of images, so I have the index show a thumbnail, linking to the larger image.


tony

--
http://tonybaldwin.me
all tony, all the time


Reply to: