By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,584 Members | 1,774 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,584 IT Pros & Developers. It's quick & easy.

Newb query: index.htm & index.php & the server default

P: n/a
The problem I'm trying to solve is as follows:
The website has two subdirectories: /ordinary and /phpstuff. Users
typing hostname/ordinary get the file index.htm by default, and this
works fine. Users typing hostname/phpstuff don't get anything because
there is no index.htm there, only index.php.
What can I put in an index.htm file that'll invoke the index.php file?
Or is there a setting in the Apache 2.0 server I've overlooked?

Win2000; Apache 2.0.43; php 4.3.3; MySQL 4.0.15
--jim
Jul 17 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
I noticed that Message-ID:
<f2**************************@posting.google.com > from Lab309 contained the
following:
Users typing hostname/phpstuff don't get anything because
there is no index.htm there, only index.php.


index.php works just like index.htm

--
Geoff Berrow
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #2

P: n/a
In article <eu********************************@4ax.com>,
Geoff Berrow <bl@ckdog.co.uk.the.cat> wrote:
I noticed that Message-ID:
<f2**************************@posting.google.co m> from Lab309 contained the
following:
Users typing hostname/phpstuff don't get anything because
there is no index.htm there, only index.php.


index.php works just like index.htm


Only if the server is configured that way. Sometimes you have
to manually add index.php to the list of default filenames.

Arnoud

--
Arnoud Engelfriet, Dutch patent attorney - Speaking only for myself
Patents, copyright and IPR explained for techies: http://www.iusmentis.com/
Jul 17 '05 #3

P: n/a

The problem I'm trying to solve is as follows: The website has two
subdirectories: /ordinary and /phpstuff. Users typing hostname/ordinary
get the file index.htm by default, and this works fine. Users typing
hostname/phpstuff don't get anything because there is no index.htm
there, only index.php. What can I put in an index.htm file that'll
invoke the index.php file? Or is there a setting in the Apache 2.0
server I've overlooked?


This is an Apache problem, not a PHP issue. You need to tell Apache to set
index.php as the default for that directory. The best thing to do would be
to put in your main .htaccess file:

DirectoryIndex index.html

Alternatively, you could consider parsing all .html files for PHP, so that
you don't constantly have to switch between the two, and change filenames
[thereby breaking links] every time you decide to add PHP instructions to
an .html file:

AddType application/x-httpd-php .html

Martin Lucas-Smith www.geog.cam.ac.uk/~mvl22
www.lucas-smith.co.uk
Jul 17 '05 #4

P: n/a
Martin Lucas-Smith wrote:
This is an Apache problem, not a PHP issue. You need to tell Apache to set
index.php as the default for that directory. The best thing to do would be
to put in your main .htaccess file:

DirectoryIndex index.html


Apache would only search for index.html then -- as it presumably does
in every stock installation -- and not index.php. DirectoryIndex
accepts a (space separated) list of resources, thus you can make
Apache look for index.php by appending it to that list. The first
resource found is returned.

http://httpd.apache.org/docs-2.0/mod...directoryindex

--
Jock
Jul 17 '05 #5

P: n/a


This is an Apache problem, not a PHP issue. You need to tell Apache to
set index.php as the default for that directory. The best thing to do
would be to put in your main .htaccess file:

DirectoryIndex index.html


Apache would only search for index.html then -- as it presumably does in
every stock installation -- and not index.php. DirectoryIndex accepts a
(space separated) list of resources, thus you can make Apache look for
index.php by appending it to that list. The first resource found is
returned.


Sorry, that was a typo - I did mean

DirectoryIndex index.html index.php

(This will use index.html if it finds that, if not, index.php, etc.)
Martin Lucas-Smith www.geog.cam.ac.uk/~mvl22
www.lucas-smith.co.uk


Jul 17 '05 #6

P: n/a
Lab309 wrote:
The problem I'm trying to solve is as follows:
The website has two subdirectories: /ordinary and /phpstuff. Users
typing hostname/ordinary get the file index.htm by default, and this
works fine. Users typing hostname/phpstuff don't get anything because
there is no index.htm there, only index.php.
What can I put in an index.htm file that'll invoke the index.php file?
Or is there a setting in the Apache 2.0 server I've overlooked?


you can create .htaccess file with: "DirectoryIndex index.php"

--
Avdija A. Ahmedhodzic
avdija @ epn ba

Prevencija putem edukacije
http://www.narkomanija.ba/

Jul 17 '05 #7

P: n/a
te*******@hotmail.com (Lab309) wrote in message news:<f2**************************@posting.google. com>...
The problem I'm trying to solve is as follows:
The website has two subdirectories: /ordinary and /phpstuff. Users
typing hostname/ordinary get the file index.htm by default, and this
works fine. Users typing hostname/phpstuff don't get anything because
there is no index.htm there, only index.php.
What can I put in an index.htm file that'll invoke the index.php file?
Or is there a setting in the Apache 2.0 server I've overlooked?

Win2000; Apache 2.0.43; php 4.3.3; MySQL 4.0.15
--jim


Thank you all. I'll modify the Apache file later today.
--jim
Jul 17 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.