domain name pointing to a page

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

    domain name pointing to a page

    My clients would like to have their own domain name but pointing at a
    webpage.

    if somebody clicks www.clientsite.com

    the site should point to

    www.mysite.com?client=455

    It is possible ? how ?

    Bob


  • Alvaro G Vicario

    #2
    Re: domain name pointing to a page

    *** Bob Bedford wrote/escribió (Tue, 24 May 2005 09:28:31 +0200):[color=blue]
    > My clients would like to have their own domain name but pointing at a
    > webpage.
    >
    > if somebody clicks www.clientsite.com
    >
    > the site should point to
    >
    > www.mysite.com?client=455
    >
    > It is possible ? how ?[/color]

    <?

    header('Locatio n: http://www.mysite.com? client=455');
    exit;

    ?>

    --
    -- Álvaro G. Vicario - Burgos, Spain
    -- http://bits.demogracia.com - Mi sitio sobre programación web
    -- Don't e-mail me your questions, post them to the group
    --

    Comment

    • Bob Bedford

      #3
      Re: domain name pointing to a page


      "Alvaro G Vicario" <alvaro_QUITAR_ REMOVE@telecomp uteronline.com> a écrit
      dans le message de news: 1j0rfwcdstiw8.1 tt5fgcbgclxl$.d lg@40tude.net.. .[color=blue]
      > *** Bob Bedford wrote/escribió (Tue, 24 May 2005 09:28:31 +0200):[color=green]
      >> My clients would like to have their own domain name but pointing at a
      >> webpage.
      >>
      >> if somebody clicks www.clientsite.com
      >>
      >> the site should point to
      >>
      >> www.mysite.com?client=455
      >>
      >> It is possible ? how ?[/color]
      >
      > <?
      >
      > header('Locatio n: http://www.mysite.com? client=455');
      > exit;
      >
      > ?>[/color]
      My question was mainly how to get that the client typed www.clientsite.com
      and then redirect. I know how to redirect, I don't know how to get the typed
      URL.


      Comment

      • Steve

        #4
        Re: domain name pointing to a page


        It sounds to me like you imagine that a request can be plucked out of
        the ether before it reaches a host and redirected to somewhere of your
        choosing. Your clients must first buy the domain "clientsite.com " and
        then set up the redirect as suggested using any of the usual methods,
        including the specific one provided by Alvaro.

        When someone types the URL "http://www.clientsite. com" into their
        browser address bar, the browser contacts their ISP and asks for the IP
        address of the host "www.clientsite .com". The ISP knows the IP address
        because the domain name has been bought and registered and so exists in
        the Domain Naming System. Back comes the reply 216.37.46.27 and the
        browser then sends a request to that host. The host receives the
        request and sends back the response. If the response is a redirect
        you'll get the effect you want.

        I assume you specified "client=455 " because that is meaningful to the
        script executing at www.mysite.com. You therefore know that the request
        came originally from www.clientsite.com because you will set things up
        so www.clientsite.com is the only host that redirects to
        www.mysite.com?client=455. Some other client www.randomsite.com will
        forward to (for instance) www.mysite.com?client=123

        The PHP to determine the value of "client" is also very basic:

        ...
        $lngClient = $_GET[ "client" ];
        ...

        ---
        Steve

        Comment

        • Alvaro G Vicario

          #5
          Re: domain name pointing to a page

          *** Bob Bedford wrote/escribió (Tue, 24 May 2005 14:45:38 +0200):[color=blue]
          > I don't know how to get the typed URL.[/color]

          Short answer: you cannot.

          Long answer: you can kind of figure out. Check the $_SERVER associative
          array with print_r() or var_dump(). There're keys like HTTP_HOST or
          REQUEST_URI that maybe help you.


          --
          -- Álvaro G. Vicario - Burgos, Spain
          -- http://bits.demogracia.com - Mi sitio sobre programación web
          -- Don't e-mail me your questions, post them to the group
          --

          Comment

          • Bob Bedford

            #6
            Re: domain name pointing to a page


            "Steve" <googlespam@nas tysoft.com> a écrit dans le message de news:
            1116943063.7005 92.237350@o13g2 00...legr oups.com...[color=blue]
            >
            > It sounds to me like you imagine that a request can be plucked out of
            > the ether before it reaches a host and redirected to somewhere of your
            > choosing. Your clients must first buy the domain "clientsite.com " and
            > then set up the redirect as suggested using any of the usual methods,
            > including the specific one provided by Alvaro.
            >
            > When someone types the URL "http://www.clientsite. com" into their
            > browser address bar, the browser contacts their ISP and asks for the IP
            > address of the host "www.clientsite .com". The ISP knows the IP address
            > because the domain name has been bought and registered and so exists in
            > the Domain Naming System. Back comes the reply 216.37.46.27 and the
            > browser then sends a request to that host. The host receives the
            > request and sends back the response. If the response is a redirect
            > you'll get the effect you want.
            >
            > I assume you specified "client=455 " because that is meaningful to the
            > script executing at www.mysite.com. You therefore know that the request
            > came originally from www.clientsite.com because you will set things up
            > so www.clientsite.com is the only host that redirects to
            > www.mysite.com?client=455. Some other client www.randomsite.com will
            > forward to (for instance) www.mysite.com?client=123
            >[/color]
            Sounds like I didn't expain well the whole thing:

            www.mysite.com and www.clientsite.com both point to my website
            (www.mysite.com)
            Now, when any person type one or the other URL, then the result is my
            website.
            What I want to achieve, is that when he types www.clientsite.com, then I
            redirect to the client=455.

            So in my index.php, I'd like to know wich URL was typed (mysite.com or
            clientsite.com) and redirect if the URL is clientsite.com.
            Sounds simple, and many website do it. I'd like to know how.

            Bob


            Comment

            • Jerry Stuckle

              #7
              Re: domain name pointing to a page

              Bob Bedford wrote:[color=blue]
              >
              > "Steve" <googlespam@nas tysoft.com> a écrit dans le message de news:
              > 1116943063.7005 92.237350@o13g2 00...legr oups.com...
              >[color=green]
              >>
              >> It sounds to me like you imagine that a request can be plucked out of
              >> the ether before it reaches a host and redirected to somewhere of your
              >> choosing. Your clients must first buy the domain "clientsite.com " and
              >> then set up the redirect as suggested using any of the usual methods,
              >> including the specific one provided by Alvaro.
              >>
              >> When someone types the URL "http://www.clientsite. com" into their
              >> browser address bar, the browser contacts their ISP and asks for the IP
              >> address of the host "www.clientsite .com". The ISP knows the IP address
              >> because the domain name has been bought and registered and so exists in
              >> the Domain Naming System. Back comes the reply 216.37.46.27 and the
              >> browser then sends a request to that host. The host receives the
              >> request and sends back the response. If the response is a redirect
              >> you'll get the effect you want.
              >>
              >> I assume you specified "client=455 " because that is meaningful to the
              >> script executing at www.mysite.com. You therefore know that the request
              >> came originally from www.clientsite.com because you will set things up
              >> so www.clientsite.com is the only host that redirects to
              >> www.mysite.com?client=455. Some other client www.randomsite.com will
              >> forward to (for instance) www.mysite.com?client=123
              >>[/color]
              > Sounds like I didn't expain well the whole thing:
              >
              > www.mysite.com and www.clientsite.com both point to my website
              > (www.mysite.com)
              > Now, when any person type one or the other URL, then the result is my
              > website.
              > What I want to achieve, is that when he types www.clientsite.com, then I
              > redirect to the client=455.
              >
              > So in my index.php, I'd like to know wich URL was typed (mysite.com or
              > clientsite.com) and redirect if the URL is clientsite.com.
              > Sounds simple, and many website do it. I'd like to know how.
              >
              > Bob
              >[/color]

              Bob,

              You can't do it that way. You need to set it up in the server.

              The reason is this: When they type in http://www.clientsite.com, the DNS
              may direct it to your web server. However, your server will look at the
              incoming request, and see it isn't for www.yoursite.com - and since it
              doesn't know about www.clientsite.com, it rejects the request.

              For Apache, look up the Virtual Host command. If you're using IIS,
              there is a similar way to do this - I just haven't looked into it to
              find out how.

              --
              =============== ===
              Remove the "x" from my email address
              Jerry Stuckle
              JDS Computer Training Corp.
              jstucklex@attgl obal.net
              =============== ===

              Comment

              • Steve

                #8
                Re: domain name pointing to a page


                Ah, sorry, that makes more sense 8-)

                If you haven't got virtual hosts set up:

                For Apache:


                For IIS:



                Once you have virtual hosts set up, PHP's predefined environment
                variable $_SERVER[ 'HTTP_HOST' ] is your friend.

                Steve

                Comment

                Working...