<p>One way to do this, is use different environments for each domain and set a variable (for instance, an entry ID) for each environment. So, your <code>config/general.php</code> would look something like this:</p>

<pre><code>return array(
   '*' =&gt; array(
       // Every config setting that's the same for all domains (like devMode, omitScriptNameInUrls, etc.
   ),
   'firstDomain.com' =&gt; array(
       'siteUrl' =&gt; 'http://www.firstDomain.com/',
       'environmentVariables' =&gt; array(
           'baseUrl' =&gt; 'http://www.firstDomain.com/', // For use in asset source, for example
           'basePath' =&gt; '/path/to/public/folder/', // Same for this
           'entryId' =&gt; 5 // Or whatever the ID of your entry is
       ),
   ),
   'secondDomain.com' =&gt; array(
       'siteUrl' =&gt; 'http://www.secondDomain.com/',
       'environmentVariables' =&gt; array(
           'baseUrl' =&gt; 'http://www.secondDomain.com/', // For use in asset source, for example
           'basePath' =&gt; '/path/to/public/folder/', // Same for this
           'entryId' =&gt; 8 // Or whatever the ID of your entry is
       ),
   ),
);
</code></pre>

<p>Then, in your template (entry.html or whatever file you use as your section's template), you get the data like this:</p>

<pre><code>{% set entry = craft.entries.id(craft.config.environmentVariables['entryId']).first() %}

&lt;h4&gt;{{ entry.title }}&lt;/h4&gt;
</code></pre>

CC BY-SA 3.0
2015-06-30T13:52:58.803Z
Thanks, that worked well, but the entryId is being ignored. The setup is exactly as yours, the second domain shows the index page (Homepage), but the section entryId. Any idea?
Johannes A. Skrivanek
CC BY-SA 3.0
2015-06-30T14:21:05.363Z
Edit: I managed to get data from the entry shown in the config, but it only loads the index template and not the _entry template.
Johannes A. Skrivanek
CC BY-SA 3.0
2016-09-24T07:21:54.293Z
This looks like a more solid approach: https://codepad.co/snippet/YEt1ukTt What do you guys think?
Martijn La Feber
CC BY-SA 3.0
2015-06-29T20:49:20.217Z
2015-06-29T20:49:20.217Z
Paul
<p>Found the solution:</p>

<p>I did as written above and added</p>

<pre><code>{% include "landingpages/_entry" %}
</code></pre>

<p>to my index.html.</p>

<p>Thanks. I &lt;3 Craft.</p>

CC BY-SA 3.0
2015-06-30T14:28:10.290Z
2015-06-30T14:28:10.290Z
Johannes A. Skrivanek
<p>I have the following problem: I would like to have one craft backend / one installation for different one pager sites on different domains. The reason is, that we have one HTML template we would like to use for our landing pages for different purposes (e.g. landingpage with different testimonials) and we would like to use a different domain for each version of the landingpage.</p>

<p>My initial thought was, to build a channel and to setup it up like www.domain.com/landingpage01, www.domain.com/landingpage02 etc.</p>

<p>So how do I route mycooldomain.com to /landingpage01 and myothercooldomain.com to /landingpage02?</p>

<p>Or are there any other solutions for my problem?</p>

<multi-domain>
Multi-Site | Multi-Domain?
# Multi-Site | Multi-Domain?

(Asked by: username_0 on 2015-06-29)

I have the following problem: I would like to have one craft backend / one installation for different one pager sites on different domains. The reason is, that we have one HTML template we would like to use for our landing pages for different purposes (e.g. landingpage with different testimonials) and we would like to use a different domain for each version of the landingpage.

My initial thought was, to build a channel and to setup it up like www.domain.com/landingpage01, www.domain.com/landingpage02 etc.

So how do I route mycooldomain.com to /landingpage01 and myothercooldomain.com to /landingpage02?

Or are there any other solutions for my problem?

**Tags:** multi-domain

---

## 2 answers

### Answer by username_1 on 2015-06-29. Score: 2

One way to do this, is use different environments for each domain and set a variable (for instance, an entry ID) for each environment. So, your config/general.php would look something like this:
return array(
   '*' => array(
       // Every config setting that's the same for all domains (like devMode, omitScriptNameInUrls, etc.
   ),
   'firstDomain.com' => array(
       'siteUrl' => 'http://www.firstDomain.com/',
       'environmentVariables' => array(
           'baseUrl' => 'http://www.firstDomain.com/', // For use in asset source, for example
           'basePath' => '/path/to/public/folder/', // Same for this
           'entryId' => 5 // Or whatever the ID of your entry is
       ),
   ),
   'secondDomain.com' => array(
       'siteUrl' => 'http://www.secondDomain.com/',
       'environmentVariables' => array(
           'baseUrl' => 'http://www.secondDomain.com/', // For use in asset source, for example
           'basePath' => '/path/to/public/folder/', // Same for this
           'entryId' => 8 // Or whatever the ID of your entry is
       ),
   ),
);

Then, in your template (entry.html or whatever file you use as your section's template), you get the data like this:
{% set entry = craft.entries.id(craft.config.environmentVariables['entryId']).first() %}

{{ entry.title }}

> **Comments:**
> **username_0**: Thanks, that worked well, but the entryId is being ignored. The setup is exactly as yours, the second domain shows the index page (Homepage), but the section entryId. Any idea?  
> **username_0**: Edit: I managed to get data from the entry shown in the config, but it only loads the index template and not the _entry template.  
> **username_2**: This looks like a more solid approach: https://codepad.co/snippet/YEt1ukTt What do you guys think?  

---

### Answer by username_0 on 2015-06-30. Score: 1

Found the solution:
I did as written above and added
{% include "landingpages/_entry" %}

to my index.html.
Thanks. I <3 Craft.


---

