index?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
thomasd1
Forum Commoner
Posts: 80
Joined: Sat Nov 22, 2003 2:48 pm
Location: Belgium

index?

Post 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:
microthick
Forum Regular
Posts: 543
Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC

Post 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.
User avatar
thomasd1
Forum Commoner
Posts: 80
Joined: Sat Nov 22, 2003 2:48 pm
Location: Belgium

Post by thomasd1 »

Thanks a lot !!
Brian
Forum Contributor
Posts: 116
Joined: Thu Apr 18, 2002 5:33 pm

You can also use a .htaccess file.

Post 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.
Post Reply