Obtaining the URL

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

    Obtaining the URL

    $_SERVER["SERVER_NAM E"] and $_SERVER["HTTP_HOST"] are good and all, but none
    of them are reliable.

    Eg: Not all subdomains will have a vhost entry for them in Apache, or the
    Host: header is not filled in.

    So are there any other methods of determining the URL of the script itself?

    Alex


  • Chung Leong

    #2
    Re: Obtaining the URL


    "Alex" <alexdow__@hotm ail.com> wrote in message
    news:35FGc.2169 6$WM5.949996@ne ws20.bellglobal .com...[color=blue]
    > $_SERVER["SERVER_NAM E"] and $_SERVER["HTTP_HOST"] are good and all, but[/color]
    none[color=blue]
    > of them are reliable.
    >
    > Eg: Not all subdomains will have a vhost entry for them in Apache, or the
    > Host: header is not filled in.
    >
    > So are there any other methods of determining the URL of the script[/color]
    itself?[color=blue]
    >
    > Alex
    >[/color]

    The answer is no, as the URL itself is not passed in the request.


    Comment

    • Michael Austin

      #3
      Re: Obtaining the URL

      Chung Leong wrote:
      [color=blue]
      > "Alex" <alexdow__@hotm ail.com> wrote in message
      > news:35FGc.2169 6$WM5.949996@ne ws20.bellglobal .com...
      >[color=green]
      >>$_SERVER["SERVER_NAM E"] and $_SERVER["HTTP_HOST"] are good and all, but[/color]
      >
      > none
      >[color=green]
      >>of them are reliable.
      >>
      >>Eg: Not all subdomains will have a vhost entry for them in Apache, or the
      >>Host: header is not filled in.
      >>
      >>So are there any other methods of determining the URL of the script[/color]
      >
      > itself?
      >[color=green]
      >>Alex
      >>[/color]
      >
      >
      > The answer is no, as the URL itself is not passed in the request.
      >
      >[/color]

      Chung: the answer is yes... hint: use phpinfo() to find it... then
      search the docs to see how to code it...

      Both the source and the target are specified.

      Michael Austin.

      Comment

      • Chung Leong

        #4
        Re: Obtaining the URL


        "Michael Austin" <maustin@firstd basource.com> wrote in message
        news:VTHGc.1169 6$aR2.4226@news svr24.news.prod igy.com...[color=blue]
        > Chung Leong wrote:
        >[color=green]
        > > "Alex" <alexdow__@hotm ail.com> wrote in message
        > > news:35FGc.2169 6$WM5.949996@ne ws20.bellglobal .com...
        > >[color=darkred]
        > >>$_SERVER["SERVER_NAM E"] and $_SERVER["HTTP_HOST"] are good and all, but[/color]
        > >
        > > none
        > >[color=darkred]
        > >>of them are reliable.
        > >>
        > >>Eg: Not all subdomains will have a vhost entry for them in Apache, or[/color][/color][/color]
        the[color=blue][color=green][color=darkred]
        > >>Host: header is not filled in.
        > >>
        > >>So are there any other methods of determining the URL of the script[/color]
        > >
        > > itself?
        > >[color=darkred]
        > >>Alex
        > >>[/color]
        > >
        > >
        > > The answer is no, as the URL itself is not passed in the request.
        > >
        > >[/color]
        >
        > Chung: the answer is yes... hint: use phpinfo() to find it... then
        > search the docs to see how to code it...
        >
        > Both the source and the target are specified.
        >
        > Michael Austin.[/color]

        Read the OP carefully, pal. He was referring to a HTTP 1.0 scenario, where
        the host name is not included in the request. In that case when two DNS
        names are mapped to the same IP address, there's no way for the server to
        tell which of the two was actually typed in.

        Name-based virtual hosting requires HTTP 1.1--that's a well known fact.


        Comment

        • Michael Austin

          #5
          Re: Obtaining the URL

          Chung Leong wrote:[color=blue]
          > "Michael Austin" <maustin@firstd basource.com> wrote in message
          > news:VTHGc.1169 6$aR2.4226@news svr24.news.prod igy.com...
          >[color=green]
          >>Chung Leong wrote:
          >>
          >>[color=darkred]
          >>>"Alex" <alexdow__@hotm ail.com> wrote in message
          >>>news:35FGc.2 1696$WM5.949996 @news20.bellglo bal.com...
          >>>
          >>>
          >>>>$_SERVER["SERVER_NAM E"] and $_SERVER["HTTP_HOST"] are good and all, but
          >>>
          >>>none
          >>>
          >>>
          >>>>of them are reliable.
          >>>>
          >>>>Eg: Not all subdomains will have a vhost entry for them in Apache, or[/color][/color]
          >
          > the
          >[color=green][color=darkred]
          >>>>Host: header is not filled in.
          >>>>
          >>>>So are there any other methods of determining the URL of the script
          >>>
          >>>itself?
          >>>
          >>>
          >>>>Alex
          >>>>
          >>>
          >>>
          >>>The answer is no, as the URL itself is not passed in the request.
          >>>
          >>>[/color]
          >>
          >>Chung: the answer is yes... hint: use phpinfo() to find it... then
          >>search the docs to see how to code it...
          >>
          >>Both the source and the target are specified.
          >>
          >>Michael Austin.[/color]
          >
          >
          > Read the OP carefully, pal. He was referring to a HTTP 1.0 scenario, where
          > the host name is not included in the request. In that case when two DNS
          > names are mapped to the same IP address, there's no way for the server to
          > tell which of the two was actually typed in.
          >
          > Name-based virtual hosting requires HTTP 1.1--that's a well known fact.
          >
          >[/color]

          My apologies Chung, but, I did not see anywhere in the OP where he
          mentions he was using HTTP 1.0. It is possible that he is, it is just
          not stated. HTTP_REFERER is in both RFC's for HTTP. I don't have a
          HTTP/1.0 server to test to see what server name is in the URL using
          vhosts... I have used this reliably for a long time now...

          So, Alex, did any of this solve your problem?

          if not, then you can always define a <input type=hidden...> to define
          the full path, however, you will need to be aware that anyone looking at
          the source will be able to see it...

          Michael Austin.

          Comment

          Working...