Default/Generic Index


I’m working on a generic index script (php) that I would eventually like to use as a default index when users navigate to an open directory.

For example, if I go to, and index.html exists in that directory, then index.html will be displayed, as expected…

If, however, I navigate to an open directory (say, containing no index.html/php/txt, then I would like the generic index to be displayed.

I have this part working, after adding the following line to .htaccess:

DirectoryIndex index.html index.php index.txt /genericindex/index.php

The only problem now is that /genericindex/index.php is pulling content (files and folders) from its own directory (/genericindex/) rather than the directory it’s “subbing in for”. Is there a way I can have /genericindex/index.php think it’s in the directory that it’s working for?

Thanks for any help!


Read the PHP documentation on server variables. The web server sets a variable telling you what the url-path is.

:cool: -//- One-time [color=#6600CC]$50.00 discount[/color] on [color=#0000CC]DreamHost[/color] plans: Use ATROPOS7


Thanks! $_SERVER[‘REQUEST_URI’] did the trick.