By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,244 Members | 1,772 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,244 IT Pros & Developers. It's quick & easy.

domain name pointing to a page

P: n/a
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
Jul 17 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
*** Bob Bedford wrote/escribió (Tue, 24 May 2005 09:28:31 +0200):
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 ?


<?

header('Location: 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
--
Jul 17 '05 #2

P: n/a

"Alvaro G Vicario" <al******************@telecomputeronline.com> a écrit
dans le message de news: 1j******************************@40tude.net...
*** Bob Bedford wrote/escribió (Tue, 24 May 2005 09:28:31 +0200):
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 ?


<?

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

?>

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.
Jul 17 '05 #3

P: n/a

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

Jul 17 '05 #4

P: n/a
*** Bob Bedford wrote/escribió (Tue, 24 May 2005 14:45:38 +0200):
I don't know how to get the typed URL.


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
--
Jul 17 '05 #5

P: n/a

"Steve" <go********@nastysoft.com> a écrit dans le message de news:
11**********************@o13g2000cwo.googlegroups. com...

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

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
Jul 17 '05 #6

P: n/a
Bob Bedford wrote:

"Steve" <go********@nastysoft.com> a écrit dans le message de news:
11**********************@o13g2000cwo.googlegroups. com...

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

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


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.
js*******@attglobal.net
==================
Jul 17 '05 #7

P: n/a

Ah, sorry, that makes more sense 8-)

If you haven't got virtual hosts set up:

For Apache:
http://httpd.apache.org/docs/vhosts/

For IIS:

http://www.microsoft.com/technet/pro...out/steps.mspx

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

Steve

Jul 17 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.