Web Hosting Talk







View Full Version : How do i make a web directory pick up a .php file?


EyeSee
08-14-2001, 03:13 PM
How do i get my server to go to a .php file like they go to index.html?

So i want index.php to be brought up?

qslack
08-14-2001, 03:47 PM
You need to specify the DirectoryIndex for the directory or location.

You can do this in either a .htaccess file or in httpd.conf inside a <Location> or <Directory> directive.

Example:
<Location />
DirectoryIndex index.php
</Location>

EyeSee
08-14-2001, 05:57 PM
Is it something simple that can be added to the server as i will want all the virtual sites created to accept .php indexes aswell?

blofish
08-14-2001, 06:22 PM
There is a Directory Index Clause
for main server configuration in your httpd.conf

blofish
08-14-2001, 06:24 PM
Here's the whole line you probably want.

They work in order as specified.. first itll search for index.cgi
then index.php then index.php3 etc etc


DirectoryIndex index.cgi index.php index.php3 index.shtml index.html index.htm main.html main.htm

EyeSee
08-15-2001, 11:47 AM
On my server i got the directory /etc/httpd/conf/ then there's three ssl directories. Where do i add that line? Do i need to create some sort of file?

Thanks for any help

Ericd
08-15-2001, 01:49 PM
loged as root, do the following:

pico /etc/httpd/conf/httpd.conf

Then, found the lines

#DirectoryIndex: Name of the file or files to use as pre-written HTML
#directory index. Separate entries with space.
#
<IfModule mod_dir.c>
DirectoryIndex index.html index.htm default.htm default.html
</IfModule>

Add index.php and all the other you want, so it will looks like:

#DirectoryIndex: Name of the file or files to use as pre-written HTML
#directory index. Separate entries with space.
#
<IfModule mod_dir.c>
DirectoryIndex index.html index.htm default.htm default.html index.php index.htm index.shtml index.cgi
</IfModule>

Save the file and exit pico.

Restart apache

/etc/rc.d/init.d/httpd stop

/etc/rc.d/init.d/httpd start

And type in the url of the directory, it should use index.php as index :)

EyeSee
08-15-2001, 04:11 PM
simple question, how do i save and exit? :rolleyes:

Ericd
08-15-2001, 04:29 PM
Ctrl+X when it asks to save modified buffer, press Y.

EyeSee
08-16-2001, 09:12 AM
Thanks for your help :cool:

Ericd
08-16-2001, 12:43 PM
You're welcome :pimp: