Default/Generic Index


#1

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 www.mydomain.com, and index.html exists in that directory, then index.html will be displayed, as expected…

If, however, I navigate to an open directory (say, www.mydomain.com/photography) 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!


#2

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

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


#3

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