Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for
Directory listing, IndexOptions query
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- Directory listing, IndexOptions query
Directory listing, IndexOptions query
26-01-2010 3:56 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
How do I get an http access to a directory without an index.htm file to return a directory listing instead of 403:Forbidden. This was the default on my site before I moved it over to PAYH. I tried putting an IndexOptions line in the /.htaccess file, but with no success.
Thanks.
Thanks.
Message 1 of 7
(1,287 Views)
6 REPLIES 6
Re: Directory listing, IndexOptions query
29-01-2010 1:18 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
I've not used PAYH, so I don't know if it allows it, but the option in .htaccess for this is:
Options +Indexes
Message 2 of 7
(339 Views)
Re: Directory listing, IndexOptions query
29-01-2010 2:41 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
It doesn't - probably for the best.
You could combine a rewrite in htaccess with a listing script, but that's maybe getting a bit complicated. Is it essential?
Gabe
You could combine a rewrite in htaccess with a listing script, but that's maybe getting a bit complicated. Is it essential?
Gabe
Message 3 of 7
(339 Views)
Re: Directory listing, IndexOptions query
30-01-2010 7:56 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
> Is it essential?
Not having auto-generated directory listings is an occasioanal pain. I have quite a few directories where I have files and previously relied on the server-generated directory listing to provide a list if contents rather than me having to write an index.htm file and, crucially, remember to update it to accurately reflect the contents of what was actually in the directory, frinstace: http://mdfs.net/temp/ which gets stuff chucked in and out frequently. The whole point of computers is for them to do things instead of humans, why should I be using my neurons creating a list of directory contents when there's a perfectly functioning server than can do all that for me with no recourse to my mental energy.
Ta.
Not having auto-generated directory listings is an occasioanal pain. I have quite a few directories where I have files and previously relied on the server-generated directory listing to provide a list if contents rather than me having to write an index.htm file and, crucially, remember to update it to accurately reflect the contents of what was actually in the directory, frinstace: http://mdfs.net/temp/ which gets stuff chucked in and out frequently. The whole point of computers is for them to do things instead of humans, why should I be using my neurons creating a list of directory contents when there's a perfectly functioning server than can do all that for me with no recourse to my mental energy.
Ta.
Message 4 of 7
(339 Views)
Re: Directory listing, IndexOptions query
31-01-2010 5:55 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Quote from: mdfsnet crucially, remember to update it
Shouldn't have to do that. Try a script like this. Call it anything.php and make it executable and it'll list the contents of the folder it's in. There are more elaborate ways of doing this but.
<?php
echo "<table border='1'>
<tr>
<th>Name</th>
<th>kb</th>
<th>Permissions</th>
<th>User</th>
<th>Mod date</th>
</tr>";
passthru("find . -maxdepth 1 -printf '<tr><td>%f</td><td>%k</td><td>%M</td><td>%u</td><td>%t</td></tr>'");
echo "</table>";
?>
Gabe
Message 5 of 7
(339 Views)
Re: Directory listing, IndexOptions query
01-02-2010 11:36 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
That will work but personally systeming out (as passthrough does) is a bit messy, and should really be avoided. I'd use something like:
There's not as much information as your version initially but you could always combine it with stat to give the information you want.
<?php
// header type stuff goes here
echo "<ul>\n";
$dir = opendir('.');
while ($file = readdir($dir))
{
if (preg_match('/^\./', $file))
{
continue;
}
echo "\t<li><a href=\"$file\">$file</a></li>\n";
}
closedir($dir);
echo "</ul>\n";
// footer stuff here
?>
There's not as much information as your version initially but you could always combine it with stat to give the information you want.
Message 6 of 7
(339 Views)
Re: Directory listing, IndexOptions query
01-02-2010 12:42 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Thinking about it
(helpful if I'd done that earlier
) the system call will only work on PAYH if you're using the <a href="http://community.plus.net/forum/index.php?topic=73037.msg577649">wrapper</a> or similar. If not, you're stuck with elaborating on something like Ben's script. If you look at the use of stat <a href="http://community.plus.net/forum/index.php/topic,80496.msg655494.html#msg655494">here</a>, you'll see why I opt for the "messy" way when available.
Gabe


Gabe
Message 7 of 7
(339 Views)
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Help with my Plusnet services
- :
- Everything else
- :
- Directory listing, IndexOptions query