Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: one site on two domains with some different content..
geoff777 wrote:
perhaps its a server issue? php.ini? .htaccess?
Don’t know, but this should solve it (untested):
variable(array('name' => 'server_name', 'value' => strtolower(preg_replace('/^www\./i', '', $_SERVER['SERVER_NAME']))));
Code is topiary
Offline
Re: one site on two domains with some different content..
Jsoo,
That works perfectly.
Many thanks
Geoff
There are 10 types of people in the world: those who understand binary, and those who don’t.
Offline
Re: one site on two domains with some different content..
I’d like to know about the traffic for each site.
I’ve been playing with the txp_log table – I’ve added a field to the end called server_name.
In log.php I’ve added the ‘server_name’ line below the ‘method’ line.
$out['method'] = serverSet('REQUEST_METHOD');
$out['server_name'] = variable(array('name' => 'server_name', 'value' => strtolower(preg_replace('/^www\./i', '', $_SERVER['SERVER_NAME']))));
Then in the safe insert at the bottom of the file … I added server_name=’$server_name’ at the end.
safe_insert("txp_log", "`time`=now(),page='$uri',ip='$ip',host='$host',refer='$ref',status='$status',method='$method',server_name='$server_name'");
I felt confident it would work, which was foolish because ..
a) it doesn’t
b) my php never does.
Any help would be appreciated.
Last edited by geoff777 (2010-05-07 13:38:55)
There are 10 types of people in the world: those who understand binary, and those who don’t.
Offline
Re: one site on two domains with some different content..
variable() doesn’t return anything when its value argument is set. You could just do:
$out['server_name'] = $_SERVER['SERVER_NAME'];
Code is topiary
Offline
Re: one site on two domains with some different content..
@jsoo,
Although I’m still investigating variants, I would like to know if you have any trick under your sleeves to serve a particular TXP section from a different domain. This second domain will be just a “one-page” website, it will not need to serve any section.
To be more precise:
Main TXP site:
http://www.domain-A.com
which has a particular section:
http://www.domain-A.com/domain-B-section/
THen, I would like to have another domain (domain-B) serving the content from that section:
http://www.domain-B.com displays content from http://www.domain-A.com/domain-B-section/
——
I’ve investigated the possibilities and this are the options I’ve found:
- the “pro” way: Reverse Proxy with Apache, if I’m not wrong. But this will highly depend on access to Apache configuration. So, let’s discard this for now, as this two domains are hosted on a Dreamhost account.
- there is also the option to use a PHP Reverse Proxy, that as far as I understand, wouldn’t need any complex Apache trick, and this may be possible on a DH enviroment.
- there is also the chance to “cloak” the domain using an iframe, but I would like to avoid this option and leave it as last resort.
- maybe there is a way to “fake” Reverse Proxy by just having an script on
www.domain-B.comthat fetches the HTML fromwww.domain-A.com/domain-B-sectionand just simple serves that. Something like a wget, or curl, I think.
But if you have any better ideas about how to solve this situation, I will really appreciate that.
Thanks.
Offline
Offline
Re: one site on two domains with some different content..
@jsoo
Thanks yet again :-)
Geoff
There are 10 types of people in the world: those who understand binary, and those who don’t.
Offline