A while ago I released our first version of a module that is available on the Sitecore Marketplace to enable Sitecore to work with aliases in a multi-site environment.
The idea is that multiple websites can use the same alias names.
http://site1/alias1 -> points to item ‘/sitecore/content/site1/item/itemlvl2/item’
http://site2/alias1 -> points to item ‘/sitecore/content/site2/item/itemlvl2/item’
http://site3/alias1 -> points to item ‘/sitecore/content/site3/item/itemlvl2/item’
Sitecore out of the box supports only having a single aliasname across your complete environment. I have recently implemented this solution for one of our customers and extended the functionality to completely disable the standard Sitecore aliasresolver (so it doesn’t even call the base.Process method anymore). I also wrote a simple layout that you can add in your solution to convert any existing alias items so that they will work in the new multi-site strategy.
What the script does:
- Creates alias folders under all of the website’s (from the sitedefinitions)
- Checks all existing alias items and copies them to the newly created alias folders (based on the Target Item of the alias item). This required some logic to determine the root site for an item, but this has been built in aswell.
From then on the custom AliasResolver – that is patched from a config file which is placed in the /app_config/include folder – will resolve the items from the alias folder directly under the website instead of the System/Alias folder Sitecore normally uses.