Question about url's

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

    Question about url's

    Hello,

    I am new to PHP and I am wondering how can I set index.php to default url
    when accessing my site.
    Eg. http://www.yyyy.com/ will access the file
    http://www.yyyy.com/index.php.

    And how can I get the same file writing only http://www.yyyy.com/index

    And generally, can this be done for all files? Eg.
    http://www.yyyy.com/pages/house will access
    the page http://www.yyyy.com/pages/house.php

    - Terje

    --
    Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
  • kaptain kernel

    #2
    Re: Question about url's

    teho wrote:
    [color=blue]
    > Hello,
    >
    > I am new to PHP and I am wondering how can I set index.php to default url
    > when accessing my site.
    > Eg. http://www.yyyy.com/ will access the file
    > http://www.yyyy.com/index.php.[/color]

    Edit your apache httpd.conf and add index.php to the DirectoryIndex
    statement.
    [color=blue]
    >
    > And how can I get the same file writing only http://www.yyyy.com/index
    >
    > And generally, can this be done for all files? Eg.
    > http://www.yyyy.com/pages/house will access
    > the page http://www.yyyy.com/pages/house.php[/color]

    Again , edit your httpd.conf

    <Location /house>
    ForceType application/x-httpd-php
    </Location>

    Go to the root of your site and create a file called "house"

    touch house
    pico house

    <?
    print "hello from house";
    ?>

    This isn't a redirect - more a case of "if i come across a file called
    house, treat it like a php file and execute it"



    [color=blue]
    >teho wrote:
    > Hello,
    >
    > I am new to PHP and I am wondering how can I set index.php to default url
    > when accessing my site.
    > Eg. http://www.yyyy.com/ will access the file
    > http://www.yyyy.com/index.php.
    >
    > And how can I get the same file writing only http://www.yyyy.com/index
    >
    > And generally, can this be done for all files? Eg.
    > http://www.yyyy.com/pages/house will access
    > the page http://www.yyyy.com/pages/house.php
    >
    > - Terje
    >[/color]


    Comment

    • Tim Van Wassenhove

      #3
      Re: Question about url's

      In article <opr659pqhdct3i n9@news.Individ ual.net>, teho wrote:[color=blue]
      > Hello,
      >
      > I am new to PHP and I am wondering how can I set index.php to default url
      > when accessing my site.
      > Eg. http://www.yyyy.com/ will access the file
      > http://www.yyyy.com/index.php.
      >
      > And how can I get the same file writing only http://www.yyyy.com/index
      >
      > And generally, can this be done for all files? Eg.
      > http://www.yyyy.com/pages/house will access
      > the page http://www.yyyy.com/pages/house.php[/color]

      Your webserver has a manual. Read it.

      --

      Comment

      • teho

        #4
        Re: Question about url's

        On Wed, 28 Apr 2004 16:58:09 +0100, kaptain kernel <nospam@nospam. gov>
        wrote:
        [color=blue]
        > teho wrote:
        >[color=green]
        >> Hello,
        >>
        >> I am new to PHP and I am wondering how can I set index.php to default
        >> url
        >> when accessing my site.
        >> Eg. http://www.yyyy.com/ will access the file
        >> http://www.yyyy.com/index.php.[/color]
        >
        > Edit your apache httpd.conf and add index.php to the DirectoryIndex
        > statement.
        >[color=green]
        >>
        >> And how can I get the same file writing only http://www.yyyy.com/index
        >>
        >> And generally, can this be done for all files? Eg.
        >> http://www.yyyy.com/pages/house will access
        >> the page http://www.yyyy.com/pages/house.php[/color]
        >
        > Again , edit your httpd.conf
        >
        > <Location /house>
        > ForceType application/x-httpd-php
        > </Location>
        >
        > Go to the root of your site and create a file called "house"
        >
        > touch house
        > pico house
        >
        > <?
        > print "hello from house";
        > ?>
        >
        > This isn't a redirect - more a case of "if i come across a file called
        > house, treat it like a php file and execute it"
        >
        >
        >
        >[color=green]
        >> teho wrote:
        >> Hello,
        >>
        >> I am new to PHP and I am wondering how can I set index.php to default
        >> url
        >> when accessing my site.
        >> Eg. http://www.yyyy.com/ will access the file
        >> http://www.yyyy.com/index.php.
        >>
        >> And how can I get the same file writing only http://www.yyyy.com/index
        >>
        >> And generally, can this be done for all files? Eg.
        >> http://www.yyyy.com/pages/house will access
        >> the page http://www.yyyy.com/pages/house.php
        >>
        >> - Terje
        >>[/color]
        >
        >[/color]

        Thanks! It helped me a lot!

        - Terje


        --
        Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

        Comment

        • teho

          #5
          Re: Question about url's

          On 28 Apr 2004 16:32:30 GMT, Tim Van Wassenhove <euki@pi.be> wrote:
          [color=blue]
          > In article <opr659pqhdct3i n9@news.Individ ual.net>, teho wrote:[color=green]
          >> Hello,
          >>
          >> I am new to PHP and I am wondering how can I set index.php to default
          >> url
          >> when accessing my site.
          >> Eg. http://www.yyyy.com/ will access the file
          >> http://www.yyyy.com/index.php.
          >>
          >> And how can I get the same file writing only http://www.yyyy.com/index
          >>
          >> And generally, can this be done for all files? Eg.
          >> http://www.yyyy.com/pages/house will access
          >> the page http://www.yyyy.com/pages/house.php[/color]
          >
          > Your webserver has a manual. Read it.
          >[/color]

          I am impressed by your effort to help new users here. When I get into php
          I may give something back to others who are trying to learn php from
          scratch.
          But I bet you never asks a question here, always reading the manual and is
          pissed
          because someone actually uses this forum for what is here for:

          HELPING USERS TO LEARN AND UNDERSTAND!!!

          - Terje

          --
          Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/

          Comment

          • Justin Koivisto

            #6
            Re: Question about url's

            teho wrote:[color=blue]
            > I am impressed by your effort to help new users here. When I get into php
            > I may give something back to others who are trying to learn php from
            > scratch.
            > But I bet you never asks a question here, always reading the manual and
            > is pissed
            > because someone actually uses this forum for what is here for:
            >
            > HELPING USERS TO LEARN AND UNDERSTAND!!![/color]

            These kind of posts don't help either. You're best bet is to ignore them
            rather than retaliate, I do. ;)

            --
            Justin Koivisto - spam@koivi.com
            PHP POSTERS: Please use comp.lang.php for PHP related questions,
            alt.php* groups are not recommended.

            Comment

            • John Dunlop

              #7
              Re: Question about url's

              teho wrote:

              [ ... ]
              [color=blue]
              > Eg. http://www.yyyy.com/ will access the file
              > http://www.yyyy.com/index.php.[/color]

              If Apache is your server, DirectoryIndex is your friend.

              "Apache module mod_dir",

              [color=blue]
              > And how can I get the same file writing only http://www.yyyy.com/index[/color]

              I wouldn't publish that URI, if I were you.
              [color=blue]
              > And generally, can this be done for all files? Eg.
              > http://www.yyyy.com/pages/house will access
              > the page http://www.yyyy.com/pages/house.php[/color]

              MultiViews usually. More generally, content negotiation.

              "Apache Content Negotiation",


              What you're proposing is a good idea, in my opinion, because URI
              suffixes are pointless and potentially harmful. Congratulations .

              --
              Jock

              Comment

              • John Dunlop

                #8
                Re: Question about url's

                teho wrote:

                [ ... ]
                [color=blue]
                > But I bet you never asks a question here, always reading the manual and is
                > pissed because someone actually uses this forum for what is here for:
                >
                > HELPING USERS TO LEARN AND UNDERSTAND!!![/color]

                Really? I thought this was Usenet. Grow some skin. :-)

                --
                Jock

                Comment

                Working...