Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
one site on two domains with some different content..
hi
id like to build two sites on two domains.
some elements, like the header for example should be different.
but all the content should be the same.
so it would be perfect for me
to build one site, check the url for the different elements
but load the content from one db.
is this possible?
keep in mind that the root domain would be variable, too. so there wouldnt be just one root domain, but two.
or would it be possible to mirror certain elements from one db..?
i dont know, some hints would be a pleasure.
best
jens
Offline
Re: one site on two domains with some different content..
<txp:php>
variable(array('name' => 'server_name', 'value' => $_SERVER['SERVER_NAME']));
</txp:php>
<txp:if_variable name="server_name" value="site1.org">
<!-- items unique to site1.org -->
<txp:else />
<!-- items unique to site2.org -->
</txp:if_variable>
Code is topiary
Offline
Re: one site on two domains with some different content..
looking good, thanks :)
ill try this out, asap.
but isnt txp also always redirecting to the site_url from the admin section..?
Offline
Re: one site on two domains with some different content..
jens31 wrote:
but isnt txp also always redirecting to the site_url from the admin section..?
No, admin pages do not rely on the site URL pref.
However, the site_url
tag obviously won’t work for this site. You could make a variable
for the site URL and use that instead. Also, “View Site” and “Preview” links will go from the site URL pref. I can’t think of any other issues, but then I haven’t thought about it much ;)
Code is topiary
Offline
Re: one site on two domains with some different content..
aight, i also think, that this will work.
thanks for your help jsoo.
Offline
Re: one site on two domains with some different content..
To be on the safe side, your server name comparison should be case insensitive, as:
variable(array('name' => 'server_name', 'value' => strtolower($_SERVER['SERVER_NAME'])));
then using lower case in the if_variable
comparison (as in the previous example).
Code is topiary
Offline
Re: one site on two domains with some different content..
Hi,
I want to do the same thing …
I have a txp install running with quite a lot of articles.
I’d like to set up a second domain (both are on the same server) exactly as in Jens31 original post.
Would someone who’s tried this give me a few clues as to how I do this.
Do I do I just copy the TXP install on domain1.com into domain2.com’s folder? Is it that easy …?
Thanks
Geoff
PS I’m not worried too much about SEO as 90% of the content is syndicated news and hardly original to my sites. :)
Last edited by geoff777 (2010-04-29 09:02:47)
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..
hi geoff777
nope, you dont need no second install.
just point the second domain on exactly the same folder like the other one and everything works fine.
if you want to display different content (like different headers on each site) you can go with the code of jsoo. it works like a charm..
Offline
Re: one site on two domains with some different content..
Wow even easier!
I love TXP
Thanks for the quick reply.
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..
Hi jens31,
Could you please share the public URLs for both websites? I would like to have a sneak peek at end result :)
Thank you.
Offline
Re: one site on two domains with some different content..
for sheezy
http://blog.staatsoper.de/
http://blog.staatsballett.de/
same same, but different :)
Last edited by jens31 (2010-04-29 15:00:07)
Offline
Re: one site on two domains with some different content..
Thanks, nice site, nice trick.
I may be back later asking a few more technical details, as I’m currently thinking a similar setup, but with a not so minor difference: there is www.domainA.com, and there is www.domainB.com, and I need the latter (which is just a single homepage, no subsections) to just be an alias (or a cloaking) for www.domainA.com/B-section.
So far, the “correct” way to do it seems to be using a Reverse Proxy, but I’m not sure yet if that’s possible on client’s hosting. Will have to investigate a little more.
(Of course, there are a few dirty solutions, like using an iframe…)
Offline