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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Lab309

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

    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
  • Geoff Berrow

    #2
    Re: Newb query: index.htm & index.php & the server default

    I noticed that Message-ID:
    <f24abf2c.03092 01748.1c896624@ posting.google. com> from Lab309 contained the
    following:
    [color=blue]
    >Users typing hostname/phpstuff don't get anything because
    >there is no index.htm there, only index.php.[/color]

    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/

    Comment

    • Arnoud Galactus Engelfriet

      #3
      Re: Newb query: index.htm &amp; index.php &amp; the server default

      In article <eumqmv4at7dfkf teiq107ojv91p52 jd2vq@4ax.com>,
      Geoff Berrow <bl@ckdog.co.uk .the.cat> wrote:[color=blue]
      >I noticed that Message-ID:
      ><f24abf2c.0309 201748.1c896624 @posting.google .com> from Lab309 contained the
      >following:
      >[color=green]
      >>Users typing hostname/phpstuff don't get anything because
      >>there is no index.htm there, only index.php.[/color]
      >
      >index.php works just like index.htm[/color]

      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/

      Comment

      • Martin Lucas-Smith

        #4
        Re: Newb query: index.htm &amp; index.php &amp; the server default




        [color=blue]
        > 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?[/color]

        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



        Comment

        • John Dunlop

          #5
          Re: Newb query: index.htm &amp; index.php &amp; the server default

          Martin Lucas-Smith wrote:
          [color=blue]
          > 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[/color]

          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.



          --
          Jock

          Comment

          • Martin Lucas-Smith

            #6
            Re: Newb query: index.htm &amp; index.php &amp; the server default



            [color=blue][color=green]
            > > 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[/color]
            >
            > 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.[/color]

            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





            Comment

            • Avdija A. Ahmedhodzic

              #7
              Re: Newb query: index.htm &amp; index.php &amp; the server default

              Lab309 wrote:
              [color=blue]
              > 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?[/color]

              you can create .htaccess file with: "DirectoryI ndex index.php"

              --
              Avdija A. Ahmedhodzic
              avdija @ epn ba

              Prevencija putem edukacije


              Comment

              • Lab309

                #8
                Re: Newb query: index.htm &amp; index.php &amp; the server default

                terphenyl@hotma il.com (Lab309) wrote in message news:<f24abf2c. 0309201748.1c89 6624@posting.go ogle.com>...[color=blue]
                > 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[/color]

                Thank you all. I'll modify the Apache file later today.
                --jim

                Comment

                Working...