0

Why we create Site like below in Site definition:

  <site name="Test Site">
        <patch:attribute name="hostName">*</patch:attribute>
        <patch:attribute name="targetHostName">*</patch:attribute>
      </site>

1 Answer 1

5

When a user visits site using a host name (ex.xyz.com), sitecore code will go into site definitions, from top to bottom and try to find any matching First site definition for that. but hostName is not a required attribute. Default "website" doesn't have one either. The host name of the incoming url. May include wildcards *(ex. http://www.site.net, *.site.net, .net, pda., print..net) It’s possible to set more than one mask by using ‘|’ symbol as a separator (ex. pda.|print..net).

So * in your hostname doesn't have any meaning or you can say allowing all type of URLs. Sitecore has defined "website" site definition in a way, that all the non-matching url request are matched into "website" site definition. i.e. by not having "hostName" attribute and virtualPath/physicalPath are set to "/".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.