Configuring a Site in a Multi-site Solution
If you would like your visitors to navigate your newly created micro-site in a multi-site solution using a specific URL, you have to add site bindings and make sure your host name points to the server where the website is being hosted. In a local development environment, you can edit your hosts file to achieve this.
I am going to assume that you already created your site folder and your Home item in Sitecore for the new site.
- Add site bindings and edit your hosts file:
- Click on Bindings... from the Edit Site section and then add a new binding for you micro-site in the Internet Information Services (IIS) Manager.
- Using SIM, open up Hosts Editor and add a new hostname entry for you micro-site.
Now you need to make sure Sitecore recognises your new micro-site, to be able to do this you need to create a site definition configuration patch file and place it in the App_Config/Include folder.
- Create a site definition config file:
- Navigate to your website's installation folder and then find the Include folder under App_Config. The default location is: C:\inetpub\wwwroot\(site name)\Website\App_Config\Include.
- Copy the SiteDefinition.config.example file and rename to represent your newly created micro-site (For example: WebinarsSiteDefinition.config).
- Open up your config file using a text editor.
- In the <site> node, make sure to change the name and rootPath attributes to your desired values. Also make sure to add hostName and contentStartItem attributes and set their values.
- Save your changes and you're all set to navigate to your newly created micro-site using its host name.
- Files in the Include folder are live as soon as they have a .config extension. Leave the .example extension to keep the file disabled while editing.
- Never update or add the <site> node in Sitecore.config, always place your .config patch file in the App_Config\Include folder as it is the recommended practice by Sitecore.
- You can use pipe separated list of host names to assign multiple host names for one site definition.
Until next time!