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

  • 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
    Jan 24, 2017 at 11:19

1 Answer 1


There's a whole slew of 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.

  • 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
    Jan 24, 2017 at 19:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.