NYCPHP Meetup

NYPHP.org

[nycphp-talk] Maybe [ot] Duplicate Content.

inforequest 1j0lkq002 at sneakemail.com
Tue Feb 1 16:38:09 EST 2005


>
Original Message:
-----------------
From: Andrew Yochum andrew-at-plexpod.com |nyphp dev/internal group use|
Date: Tue, 1 Feb 2005 15:05:46 -0500
To: talk at lists.nyphp.org
Subject: Re: [nycphp-talk] Maybe [ot] Duplicate Content.
I do something similar.  I have all domains point an A record at the
same IP, which normally would cause duplicate content.  To solve that I
have an include that goes in the my prepend of every site that looks
something like:

    $Config['Hostname'] = 'www.somedomain.com'

    if ($_SERVER['HTTP_HOST'] != $Config['Hostname']) {
        Header("HTTP/1.1 301 Moved Permanently");
        Header("Location: http://" . $Config['Hostname'] .
$_SERVER['PHP_SELF'] . (StrLen($_SERVER['QUERY_STRING'])?
"?".$_SERVER['QUERY_STRING'] : ''));
        exit();
    }

... which ensures that the hostname being used to access the requested
page is the one we want to be called by...  "I'm not Drew, I'm Andrew!"
I call this "hostname assertion".

Regards,
Andrew
<

Interesting to see PHP used to "bypass" Apache config...sort of (?)

What I wonder is why this might be a good thing to do? It won't get called
unless Apache says it belongs (hence you still have to set all the A
records) and then this has to tell apache to redirect anyway (which it
would have done if properly configured).

Maybe I ammissing something or maybe it's like mountain climbing?

-=john






--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .





More information about the talk mailing list