Page 1 of 1

index?

Posted: Tue Dec 23, 2003 3:11 pm
by thomasd1
hi,
sorry, this question may have been asked before but i couldnt find it using the forumsearch, so anyway i'm using Apache2 with php and
i thougth that if you name a file index.php, it would autoload, (not showing the directory listing...)
it works with index.html, not with .php

:roll:

edit: 'm guessing i havta change something in the httpd.conf thingy but how 8O ?


edit2: i posted this message in the miscellaneous section but nobody answered ... :roll:

Posted: Tue Dec 23, 2003 3:24 pm
by microthick
You're right.

Open up your httpd.conf.

Search for DirectoryIndex and you'll find something like below:

<IfModule mod_dir.c>
DirectoryIndex index.html index.htm

etc

Add index.php to that same line, then restart apache.

Posted: Tue Dec 23, 2003 4:07 pm
by thomasd1
Thanks a lot !!

You can also use a .htaccess file.

Posted: Tue Dec 23, 2003 5:25 pm
by Brian
That presumes, of course, that you have access to your httpd.conf file, which is unavailable to most users of shared servers. You can also use a .htaccess file and if you do, you need not reset the server.

DirectoryIndex index.php index.html index.htm whatever.whatever

Just remember that the order in which you list your file names is the order in which you want Apache to try to display them as your default file. In the above example, if there is no index.php file, Apache will look for an index.html file and so on.