This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Webmaster forum > March 2007 > Parking Script





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Parking Script
Fred Atkinson

2007-03-26, 7:21 pm

My hosting provider allows me to park domain names on my
primary Web page. Of course, I want the park to go somewhere else.

Can anyone tell me where to find a PHP script of Javascript
that would do the following:

1. Allow access to the primary domain without
redirection.

2. Redirect all domains that are parked on the
primary domain to be redirected to another URL.

Regards,



Fred
Fred Atkinson

2007-03-26, 7:21 pm

On Mon, 26 Mar 2007 10:29:25 -0400, Fred Atkinson
<fatkinson@mishmash.com> wrote:

> My hosting provider allows me to park domain names on my
>primary Web page. Of course, I want the park to go somewhere else.
>
> Can anyone tell me where to find a PHP script of Javascript
>that would do the following:
>
> 1. Allow access to the primary domain without
> redirection.
>
> 2. Redirect all domains that are parked on the
> primary domain to be redirected to another URL.
>
> Regards,
>
>
>
> Fred


And I forgot to add one thing: I want the URL it is forwarded
to to be cloaked (the URL window should show the parked domain name,
not the URL it is forwarded to).

Regards,



Fred
Roman

2007-03-26, 11:18 pm

Fred Atkinson wrote:
> On Mon, 26 Mar 2007 10:29:25 -0400, Fred Atkinson
> <fatkinson@mishmash.com> wrote:
>
>
> And I forgot to add one thing: I want the URL it is forwarded
> to to be cloaked (the URL window should show the parked domain name,
> not the URL it is forwarded to).
>
> Regards,
>
>
>
> Fred


You need redirecting script inside shared root, and that script will
redirect to different locations based on the hostname.

Example:

Below is the script I normally use for running the same PHP applications
on my local devel machine and on the server with different settings. I
adjusted it for your purpose

function isHost($host)
{
$serv = $_SERVER['SERVER_NAME'];
$slen = strlen($serv);
$hlen = strlen($host);

if($slen >= $dlen)
return substr($serv, $slen-$hlen) == $host;

return FALSE;
}

if(isHost("mydomain1.com"))
{
header('Location: /1');
}
else
if(isHost("mydomain2.com"))
{
header('Location: /2');
}
else
{
header('Location: /3');
}

What this would do is that if


www.mydomain1.com redirects to directory /1
www.mydomain2.com redirects to directory /2
www.mydomain3.com redirects to directory /3

Keep in mind that your host will not be very happy about this and they
may consider it violation of terms.

--
Roman Ziak
www.dipmicro.com
Fred Atkinson

2007-03-27, 7:17 am

On Mon, 26 Mar 2007 20:50:39 -0400, Roman <me47@dipmicro.com> wrote:

>Fred Atkinson wrote:
>You need redirecting script inside shared root, and that script will
>redirect to different locations based on the hostname.
>
>Example:
>
>Below is the script I normally use for running the same PHP applications
>on my local devel machine and on the server with different settings. I
>adjusted it for your purpose
>
> function isHost($host)
> {
> $serv = $_SERVER['SERVER_NAME'];
> $slen = strlen($serv);
> $hlen = strlen($host);
>
> if($slen >= $dlen)
> return substr($serv, $slen-$hlen) == $host;
>
> return FALSE;
> }
>
> if(isHost("mydomain1.com"))
> {
> header('Location: /1');
> }
> else
> if(isHost("mydomain2.com"))
> {
> header('Location: /2');
> }
> else
> {
> header('Location: /3');
> }
>
>What this would do is that if
>
>
> www.mydomain1.com redirects to directory /1
> www.mydomain2.com redirects to directory /2
> www.mydomain3.com redirects to directory /3
>
>Keep in mind that your host will not be very happy about this and they
>may consider it violation of terms.


Actually, they won't care. I have a resellers account rather
than a hosting account. I am allowed to use as many domain names as I
care to register on my site. That is part of the service that I use.
Well, let me restate it.

Example: Run a site with mydomain.net as the domain. When you
park any other domain name, you get the content for mydomain.net.

So I created a subdomain 'park.mydomain.net'. The idea is
that any 'parked' domain gets redirected to 'park.mydomain.net' where
I can put a parking page.

I am not a PHP coder, so I'll code this to illustrate the
idea.

if $domain_name neq 'mydomain.net' then
forward to 'park.mydomain.net' ;
put $domain_name in Address bar;

So the proper domain name of the site will not cause the
script to do anything. But any other domain pointed there will
redirect it to the content in 'park.mydomain.net' with that domain in
the address bar.

I've got a script running on it now that does forward to
'park.mydomain.net' but it shows 'park.mydomain.net' instead of the
parked domain name. It does only part of what I want to happen.

Any suggestion on how to fix that?

Regards,



Fred
Fred Atkinson

2007-03-27, 7:17 am

On Tue, 27 Mar 2007 05:49:09 -0400, Fred Atkinson
<fatkinson@mishmash.com> wrote:

>On Mon, 26 Mar 2007 20:50:39 -0400, Roman <me47@dipmicro.com> wrote:
>
>
> Actually, they won't care. I have a resellers account rather
>than a hosting account. I am allowed to use as many domain names as I
>care to register on my site. That is part of the service that I use.
> Well, let me restate it.
>
> Example: Run a site with mydomain.net as the domain. When you
>park any other domain name, you get the content for mydomain.net.
>
> So I created a subdomain 'park.mydomain.net'. The idea is
>that any 'parked' domain gets redirected to 'park.mydomain.net' where
>I can put a parking page.
>
> I am not a PHP coder, so I'll code this to illustrate the
>idea.
>
> if $domain_name neq 'mydomain.net' then
> forward to 'park.mydomain.net' ;
> put $domain_name in Address bar;
>
> So the proper domain name of the site will not cause the
>script to do anything. But any other domain pointed there will
>redirect it to the content in 'park.mydomain.net' with that domain in
>the address bar.
>
> I've got a script running on it now that does forward to
>'park.mydomain.net' but it shows 'park.mydomain.net' instead of the
>parked domain name. It does only part of what I want to happen.
>
> Any suggestion on how to fix that?
>
> Regards,
>
>
>
> Fred


You know, I just thought of another way to do it that might
work.

Instead of using 'park.mydomain.net', you might do something
like this:

if $domain_name eq mydomain.net or www.mydomain.net
then
display html for mydomain.net;
else
display html for parked pages;

This would probably be simpler to code.

Regards,



Fred
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews