Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Nathan 67 posts 146 karma points
    Sep 22, 2014 @ 11:31
    Nathan
    0

    Project structure for multi site support

    I have a working Umbraco project. I have to modify project structures so that it will support multiple sites. What I've done so far:

    Back Office:

    • Created another content node that represents the new site Set Culture an Hostnames > Domain to local.projectname.net, same for first site with local.otherproject.net
    • Created new layouts for new content node
    • Added the domain names to IIS and hosts file

    This works fine if the MVC folders from project are in root.

    Visual Studio:

    enter image description here

    -Added my MVC Area 'Site1' and 'Site2' to the umbracoReservedPaths in the Web.config.

     <add key="umbracoReservedPaths" value="~/umbraco,~/install/, ~/Site1/, ~/Site2/" />
    

    -Added the class from below referenced post to register my MVC Area using custom routes:

    using System.Web.Mvc;
    using Umbraco.Core;
    
    public class MvcStartup : IApplicationEventHandler
    {
       public void OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
       {
    
       }
    
    public void OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
       {
            AreaRegistration.RegisterAllAreas();
       }
    
       public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
       {
    
       }
    } 
    

    After this, I get a blank screen on running the project. I followed the steps from this blog post :http://blog.dampee.be/post/2013/03/29/Convert-MVC-application-to-Umbraco-v6-using-Custom-Routes.aspx

    Q: What is the best way to structure the project so that will implement multiple sites in Umbraco? I guess the page is blank because Umbraco expects the views to be in root, and now the View folder from root is empty. How can I make Umbraco take the Views from my Areas? Or what have I done wrong so far? Thanks.

  • Jeroen Breuer 4909 posts 12266 karma points MVP 5x admin c-trib
    Sep 22, 2014 @ 17:43
    Jeroen Breuer
    0

    Hello,

    Did you try the "Umbraco" way of MVC? Instead of creating custom routes you let Umbraco handle the routing for you. More info here: http://our.umbraco.org/Documentation/Reference/Mvc/custom-controllers

    Jeroen

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies