header()

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

    header()

    header('Locatio n: blah.php');

    php doesnt seem to like this - am I doing something wrong and if not is
    there a fix .

    All the examples i've seen so far use http://www .
  • Andy Hassall

    #2
    Re: header()

    On Mon, 25 Jul 2005 19:28:29 +0100, SOR
    <webmaster@spar esorrepair.co.u k.INVALID> wrote:
    [color=blue]
    >header('Locati on: blah.php');
    >
    >php doesnt seem to like this - am I doing something wrong and if not is
    >there a fix .[/color]

    What makes you think PHP "doesn't seem to like this"? What does that mean?
    [color=blue]
    >All the examples i've seen so far use http://www .[/color]

    The HTTP specification requires the use of absolute URIs for the Location
    header. PHP doesn't enforce this.

    --
    Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
    <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

    Comment

    • Dave

      #3
      Re: header()

      SOR (webmaster@spar esorrepair.co.u k.INVALID) decided we needed to
      hear...[color=blue]
      > header('Locatio n: blah.php');
      >
      > php doesnt seem to like this - am I doing something wrong and if not is
      > there a fix .
      >
      > All the examples i've seen so far use http://www .
      >[/color]

      A full url is only needed if you are redirecting to another server.
      If you are staying on the same server, then you only need to specify
      a path. i.e. your code above should be changed to look something
      like...

      header('Locatio n: /blah.php');

      --
      Dave <dave@REMOVEbun dook.com>
      (Remove REMOVE for email address)

      Comment

      • Shelly

        #4
        Re: header()


        "Andy Hassall" <andy@andyh.co. uk> wrote in message
        news:tdeae1hvbg p3ja88r01u1utlr vo1cgcgdg@4ax.c om...[color=blue]
        > On Mon, 25 Jul 2005 19:28:29 +0100, SOR
        > <webmaster@spar esorrepair.co.u k.INVALID> wrote:
        >[color=green]
        >>header('Locat ion: blah.php');
        >>
        >>php doesnt seem to like this - am I doing something wrong and if not is
        >>there a fix .[/color]
        >
        > What makes you think PHP "doesn't seem to like this"? What does that mean?
        >[color=green]
        >>All the examples i've seen so far use http://www .[/color]
        >
        > The HTTP specification requires the use of absolute URIs for the Location
        > header. PHP doesn't enforce this.[/color]

        Not so. I use relative just like he did and even specifying relative paths.
        It works for me.

        Shelly


        Comment

        • Andy Hassall

          #5
          Re: header()

          On Mon, 25 Jul 2005 19:24:53 GMT, "Shelly" <sheldonlg.news @asap-consult.com>
          wrote:
          [color=blue][color=green]
          >> The HTTP specification requires the use of absolute URIs for the Location
          >> header. PHP doesn't enforce this.[/color]
          >
          >Not so. I use relative just like he did and even specifying relative paths.
          >It works for me.[/color]



          The HTTP standard requires the use of absolute URIs for the Location header.

          Most useragents allow non-conformant relative URIs - this does not make it
          correct.

          --
          Andy Hassall / <andy@andyh.co. uk> / <http://www.andyh.co.uk >
          <http://www.andyhsoftwa re.co.uk/space> Space: disk usage analysis tool

          Comment

          • SOR

            #6
            Re: header()

            <comp.lang.ph p , Dave , dave@REMOVEbund ook.com>
            <iaqfr2-9hi.ln1@fawlty. homelinux.net>
            <Mon, 25 Jul 2005 15:14:58 -0400>
            [color=blue]
            > A full url is only needed if you are redirecting to another server.
            > If you are staying on the same server, then you only need to specify
            > a path. i.e. your code above should be changed to look something
            > like...
            >
            > header('Locatio n: /blah.php');
            >[/color]

            Sounds good to me - will try it shortly .

            Comment

            • Geoff Berrow

              #7
              Re: header()

              I noticed that Message-ID:
              <MPG.1d4f3fac6e 26f3b4989d91@no-cancel.newsread er.com> from SOR contained
              the following:
              [color=blue]
              >header('Locati on: blah.php');
              >
              >php doesnt seem to like this -[/color]

              Can you be more specific?


              --
              Geoff Berrow (put thecat out to email)
              It's only Usenet, no one dies.
              My opinions, not the committee's, mine.
              Simple RFDs http://www.ckdog.co.uk/rfdmaker/

              Comment

              • SOR

                #8
                Re: header()

                <comp.lang.ph p , Geoff Berrow , blthecat@ckdog. co.uk>
                <h6qae1tg3b47s1 0slq94kqlrdlccl 55tge@4ax.com>
                <Mon, 25 Jul 2005 23:34:53 +0100>
                [color=blue][color=green]
                > >header('Locati on: blah.php');
                > >
                > >php doesnt seem to like this -[/color]
                >
                > Can you be more specific?
                >[/color]

                Rewrote things fairly quickly and cant honestly remember .

                Comment

                • John Dunlop

                  #9
                  Re: header()

                  Dave wrote:

                  [re: HTTP Location]
                  [color=blue]
                  > A full url is only needed if you are redirecting to another server.
                  > If you are staying on the same server, then you only need to specify
                  > a path.[/color]

                  sounds like you're confusing CGI headers with HTTP headers.
                  headers() deals in HTTP, not CGI.

                  --
                  Jock

                  Comment

                  • Dave

                    #10
                    Re: header()

                    John Dunlop (usenet+2004@jo hn.dunlop.name) decided we needed to hear...[color=blue]
                    > Dave wrote:
                    >
                    > [re: HTTP Location]
                    >[color=green]
                    > > A full url is only needed if you are redirecting to another server.
                    > > If you are staying on the same server, then you only need to specify
                    > > a path.[/color]
                    >
                    > sounds like you're confusing CGI headers with HTTP headers.
                    > headers() deals in HTTP, not CGI.[/color]

                    No I'm not confusing them, however I have learned since my post was
                    made that my answer does rely on the fact that many browsers relax
                    the standard for the HTTP Location header - so my answer is
                    technically incorrect for that reason.

                    The standard states an absolute uri is required for redirection,
                    but browsers relax this by allowing a relative uri and prepend
                    the most recently visited server to it.

                    --
                    Dave <dave@REMOVEbun dook.com>
                    (Remove REMOVE for email address)

                    Comment

                    • JDS

                      #11
                      Re: header()

                      On Mon, 25 Jul 2005 23:44:12 +0100, SOR wrote:
                      [color=blue]
                      > Rewrote things fairly quickly and cant honestly remember .[/color]

                      Then its gonna be hard for anyone to answer, now, ain't it?

                      --
                      JDS | jeffrey@example .invalid
                      | http://www.newtnotes.com
                      DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

                      Comment

                      • JDS

                        #12
                        Re: header()

                        On Mon, 25 Jul 2005 19:24:53 +0000, Shelly wrote:
                        [color=blue][color=green]
                        >> The HTTP specification requires the use of absolute URIs for the
                        >> Location header. PHP doesn't enforce this.[/color]
                        >
                        > Not so. I use relative just like he did and even specifying relative
                        > paths. It works for me.[/color]

                        He just said, "PHP doesn't enforce this." What do you think that means?

                        --
                        JDS | jeffrey@example .invalid
                        | http://www.newtnotes.com
                        DJMBS | http://newtnotes.com/doctor-jeff-master-brainsurgeon/

                        Comment

                        Working...