<p>There's a whole slew of <a href="https://craftcms.com/docs/php-constants" rel="nofollow noreferrer">PHP constants</a> you can define in each public <code>index.php</code> file to separate out the templates, config settings, etc. for each of the sites.</p>

<p>It's a very similar method we use for <a href="https://craftcms.com" rel="nofollow noreferrer">https://craftcms.com</a>, too (just based on subdomains instead of subfolders.</p>

CC BY-SA 3.0
2017-01-24T19:58:13.933Z
Ok - perfect - thanks Brad. That's the path I started down today after my question (and as per my follow up comment using the CRAFT_TEMPLATES_PATH variable to separate templates). Glad to hear those are the tools you're using via subdomains.
Mike
CC BY-SA 3.0
2017-01-24T19:29:58.520Z
2017-01-24T19:29:58.520Z
Brad Bell
<p>We are trying to add Craft alongside another CMS. I currently have Craft setup with the Craft app directory above web root and then two web accessible sub-directories as follows:</p>

<ul>
<li>blog</li>
<li>offer</li>
</ul>

<p>Each subdirectory has a Craft index.php file in it, pointing to the one craft app directory above web root.</p>

<p>My issue now is trying to serve up a different set of pages based on which sub-directory the user accesses (ie. "www.domain.com/offer" or "www.domain.com/blog"). I thought I could add routes to do this but they don't seem to work as I'd hoped.</p>

<p>Are routes the right way to do this? I thought I could have defined a route of "blog/" to load a specific template but that does not work (I assume that first URL segment isn't available to the route based on having the index.php file in that directory?).</p>

<p>Is there another way to handle this that I haven't thought of?</p>

<p>Thanks,
Mike</p>

CC BY-SA 3.0
2017-01-24T11:19:12.323Z
Not answering my question but thinking out loud on this post. Would defining a different set of templates via the CRAFT_TEMPLATES_PATH in one of the index.php files be a possible work-around? Not certain what kind of other issues that might cause (if any)... ?
Mike
<routes><routing><multi-domain>
Running Craft from two subdirectories
# Running Craft from two subdirectories

(Asked by: username_0 on 2017-01-24)

We are trying to add Craft alongside another CMS. I currently have Craft setup with the Craft app directory above web root and then two web accessible sub-directories as follows:

* blog
* offer

Each subdirectory has a Craft index.php file in it, pointing to the one craft app directory above web root.

My issue now is trying to serve up a different set of pages based on which sub-directory the user accesses (ie. "www.domain.com/offer" or "www.domain.com/blog"). I thought I could add routes to do this but they don't seem to work as I'd hoped.

Are routes the right way to do this? I thought I could have defined a route of "blog/" to load a specific template but that does not work (I assume that first URL segment isn't available to the route based on having the index.php file in that directory?).

Is there another way to handle this that I haven't thought of?

Thanks,
Mike

**Tags:** routes, routing, multi-domain
> **Comments:**
> **username_0**: Not answering my question but thinking out loud on this post. Would defining a different set of templates via the CRAFT_TEMPLATES_PATH in one of the index.php files be a possible work-around? Not certain what kind of other issues that might cause (if any)... ?  

---

## 1 answers

### Answer by username_1 on 2017-01-24. Score: 0 | Accepted answer

There's a whole slew of [PHP constants](https://craftcms.com/docs/php-constants) you can define in each public `index.php` file to separate out the templates, config settings, etc. for each of the sites.

It's a very similar method we use for <https://craftcms.com>, too (just based on subdomains instead of subfolders.

> **Comments:**
> **username_0**: Ok - perfect - thanks Brad. That's the path I started down today after my question (and as per my follow up comment using the CRAFT_TEMPLATES_PATH variable to separate templates). Glad to hear those are the tools you're using via subdomains.  

---

