Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sitecore Multiple Sites - Using Wildcards With hostName Attribute

Tags:

sitecore

I'm having an issue with getting a site set up in the web.config file for a Sitecore site. Specifically I can't figure how to use the hostName property to capture the "www" subdomain for a domain (e.g. www.mydomain.com) as well as no specified subdomain (e.g. mydomain.com).

I've experimented a little and found that I can do something like *.mydomain.com and it works. But the problem is that we want users to also be able to go to just mydomain.com and have the site come up. When I have the hostName configured as *.mydomain.com this apparently is not possible.

Any ideas? The Sitecore developer network doesn't say too much on this (unless it's hidden somewhere I couldn't find).

Craig

like image 895
Craig Koster Avatar asked Mar 03 '11 20:03

Craig Koster


1 Answers

For a bit more precision than Mark's removing the dot (which will work) you can use pipe separation to list alternative names:

<site hostName="mydomain.com | *.mydomain.com" ... />

That would allow you to configure a second site reallymydomain.com without it being caught by the hostName above. Remember the sites list will be processed in order, so the first match counts even if there's a second match that is more specific.

like image 137
James Walford Avatar answered Oct 08 '22 18:10

James Walford