Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Multiple sites - Localhost - Best Practice

Vote:
 

Hey,

I've been trying to setup multiple sites on a page I've been working on, and know how to make it work live, but not locally.

The main problem is how to solve it using best practice, as I would like the project to be as maintainable as possible for future support cases and whatnot.

The two sites are almost identical, but the 2nd site needs a new StartpageModel and probably a new ArticleModel, along with a new stylesheet. 
How I've solved this now is by adding a new model and calling it : StartPageClientName, as opposed to the old StartPage. 

This obviously generates a lot of code that's fairly similar, but still have some variations from eachother.

Now, after I've added all these new models/controllers and views, I go into /episerver/cms and add a new startpage of the new type.
Then i go to Admin->Manage Sites, and change the Startpage to the new one.

This means that the old site is unaccesible and most likely throws a 404 error

Once i go Live i will of course make two sites point to their own StartPage, and disable all the templates/models that the respective sites shouldn't be able to create.

Have i gone about this the correct way or should it be done differently? 

Any thoughts on the matter is very welcome :)

#115094
Jan 09, 2015 9:36
Vote:
 

I think you may find it helpful. What we usually do:

- register multiple domains in our hosts file (or router), customer1, customer2, etc.

- all these domains point to 127.0.0.1 (or basically to your local IIS)

- then we usually create separate start page types (or most probably templates as well). you can majority of properties probably extract to abstract startpage type class that will be shared across customers. Let's say you may end up with: 

abstract class BaseStartPage
{
    // shared properties like Heading, etc
}

class Customer1StartPage : BaseStartPage {}
class Customer2StartPage : BaseStartPage {}

- create also new startpage templates (usually to get new look and feel if needed)

- then we create multiple sites inside EPiServer: one for Customer1 and another for Customer2

- point each site to particular domain (registered earlier)

- and set start page for each site to particular start pages (probably you will need to create them first)

Now you are able to browse to customer site #1 and customer site #2 at the same time.

Btw, if look and feel is almost the same with some small exceptions, I would look for a way to create a property on the page that may regulate which CSS style file you pick. And again this custom CSS file may override only absolut minimum required for other site to look as required by that customer.

#115140
Jan 09, 2015 21:07
Vote:
 

What are the main difference between these models?

You can differentiate through different page types and use base classes as Valdis suggested.

Other things you can do is to use Display Channels if you only want to display things differently depending on each website. http://world.episerver.com/documentation/items/developers-guide/episerver-cms/7/content/display-channels/

With this Display Channel you can resolve which css you'd like to use as well as using the same page type but different templates using Tags.

But again, what are the main differences between the models, for example start page and article?

#115146
Jan 10, 2015 10:55
Vote:
 

1. I edited my host files as follows:

127.0.0.1 localhost
127.0.0.1 testsite

2. Went into Admin mode on the first site and created a new start page.

3. Went into Admin mode >> Config  >> Manage Websites   and did the Add New Site.

http:// testsite  and  gave it the start page that i created in #2.

4.  Tried to navigate to the nwely created site http://testsite   but it does not got to the new start page.  It's like the new site doesn't actually exist in IIS Express.

Recall that I am running in Visual Studio 2017 debug mode, which is IIS Express.  When I look at the taskbar for IIS Express, under the View Sites, I only see my first site (localhost:xxx1). I don't see testsite.  

Has anyone gotten thi running in Visual Studio Debug mode (IIS Express)?  This should be easily reproducible.  Just create a new Epi CMS project, run it with the sample alloy site, and try to create a nwe second site (multi site).

#204471
Jun 04, 2019 1:16
Vote:
 

1. I edited my host files as follows:

127.0.0.1 localhost
127.0.0.1 testsite

2. Went into Admin mode on the first site and created a new start page.

3. Went into Admin mode >> Config  >> Manage Websites   and did the Add New Site.

http:// testsite  and  gave it the start page that i created in #2.

4.  Tried to navigate to the nwely created site http://testsite   but it does not got to the new start page.  It's like the new site doesn't actually exist in IIS Express.

Recall that I am running in Visual Studio 2017 debug mode, which is IIS Express.  When I look at the taskbar for IIS Express, under the View Sites, I only see my first site (localhost:xxx1). I don't see testsite.  

Has anyone gotten thi running in Visual Studio Debug mode (IIS Express)?  This should be easily reproducible.  Just create a new Epi CMS project, run it with the sample alloy site, and try to create a nwe second site (multi site).

#204472
Jun 04, 2019 1:17
Vote:
 

For IIS Express you need to edit .vs\YourProject\config\applicationhost.config and add the bindings (search for: <site name=").

Some find it easier to use the real IIS but I always try hard to first get IIS Express to work as needed.

To avoid problems later on we always run everything on HTTPS as well.

#204577
Jun 10, 2019 10:35
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.