Question

You know how when you go to a url on a server and the directory doesn't have an index.* file or a default.* file it shows you a list of the directorie's contents? I was wondering if there is any way to customize the way that index looks or theme it to fit your site. For instance I'd want to add the php

<?
include 'template.php';

head();
?>

Before the listing. And

<?php
foot();
?>

After. Can this be done?

Était-ce utile?

La solution

I have never done this before, but this shows how to do it: http://www.webmasterworld.com/apache/3589651.htm via .htaccess.

Edit: Maybe this shows exactly what you want, it's a walk-through of how to embed header and footer in the listing page.

Autres conseils

Sure, you can add your own DirectoryIndex file which can even be PHP.

In you .htaccess file:

DirectoryIndex my-dir-listing.php

Do inside the my-dir-listing.php file whatever you need to do the directory listing.

If you want to modify the header of the existing listing, take a look into the HeaderName directive.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top