Sitecore Hidden Gems: Virtual Site setup

Multi-Site setup with Sitecore

Sitecore is in my opinion one of the easiest CMS's out there to facilitate a multi-site setup. It offers a number of approaches to doing so. You can either create entirely different structures and implement it as such so that through security and configuration entire different structures can be disclosed while at the same time specific content can still be shared in one location.

But you can just as easily decide that a specific node within your website should function as a seperate site with its own visualisation and behavior.

For example, you might want the following structure within Sitecore :
"Corporate Home > Tertiary pages > B2B > Support" to be disclosed under the following url:

http://www.corporate.com/support/

In order to do so I tend to revert to the Virutal Site setup that is available within Sitecore

How-To

Siteore configures its mapping of the various path, hostnames, databases and so on through the SiteDefinition.config file. Found under "App_config > Include"

The entries defining the sites look like this:


As you can see, both the virtualFolder and the physicalFolder are set to the root "/".
The Sitedefinition file contains multiple entries in a multi-site setup, one for each configured website.
Sitecore resolves the site definitions sequentually, meaning that more specific configurations have to be placed on top and more generalistic ones go to the bottom !

In the description of all configuration properties, the virtualFolder is described as followed:
"The prefix to match for incoming URL's. This value will be removed from the URL and the remainder will be treated as the item path."

By setting BOTH (!) the virtualFolder and the physicalFolder to the required path you can disclose the required structure and site: virtualFolder="/Home/TertiaryPage/B2B/Support"

If this change is not done on both the virtualFolder and physicalFolder, Sitecore tends to give an error on all sites (this is a general configuration file):



Pitfalls and other options ?

There are a number of things that you do have to keep in mind when choosing for the solution through a virtual folder...

Location of language parameter in the url

Sitecore has the habit of making you used to the following url structure:
http://www.corporate.com/en/some-kind-of-page/

So the first part (up to the language "/en") is the actual base url followed by the last part which is your navigation path within the site.

However, when using the virtual site setup you will have the following:
http://www.corporate.com/en/support/some-kind-of-support-page/

where you might be expecting (for logic reading and SEO purposes) :
http://www.corporate.com/support/en/some-kind-of-support-page/

After requesting this with Sitecore it does not yet appear to be possible at this point to do this via configuration. Custom code might make this work but I do not have this available.

Link resolving with Sitecore

Make sure you do extensive testing when you have an extreme case of custom link provider implementations and cross site linking to make sure that the virtual site setup does not break any functionality. Some tweaks to the link provider should take care of possible issues, if any.

Alternative solution

If the above solution is not possible, too complicated in your current setup or the site that is to be disclosed has its content fragmented across different nodes you can use a reverse proxy setup within IIS to get you on your way. Do keep in mind that this requires a lot of IT configuration, handling of specific cases (media, cross-linking) and so on.










Comments

  1. You can disable the strip language setting and language embedding to never. Then you can have any virtual folder setup in Sitecore.

    ReplyDelete

Post a Comment

Popular posts from this blog

Stupid exception: Device is not ready – System.IOException .net

Date Ranges in C#

Sitecore 8.2 in-depth preview + 8.3 update info and Sitecore Ecommerce information