Microsoft Office Tutorials and References
In Depth Information
After the web application is generated, you’ll need to create the initial site collection (my
example is techsite to keep with the tech theme) just as we did earlier in this chapter. Keep in
mind that in order for users to successfully browse to this URL, they’ll need to be able to resolve
it in DNS to the IP address of your SharePoint server (so make certain that there is a record in
DNS that resolves to the server’s IP). Once everything is created and IIS has been reset, you’ll be
able to see the host header information in IIS.
Open Internet Information Services (IIS) Manager, and browse to Web Sites in the tree pane.
Then in the Actions pane, click the Bindings link. The default port of 80 will be listed for the site,
and it will show the host header URL, as shown in Figure 10.69.
The host header
of the new Web
Site in IIS
Of course, browsing to the new URL (in my case http://tech.dem0tek.com) will take you to
the new site.
SITE COLLECTIONS AND HOST HEADERS
Officially, you need to create a new web application to use a host header; however, STSADM (and
PowerShell) has an undocumented feature (or should we say, underdocumented ) that lets you create
a new site collection using a host header.
Remember, site collections reside in web applications, and adding a new site collection to the web
application usually means you have to place the new site collection in one of the managed paths
for that web application (by default, the /sites/ path). However, you can add a site collection to a
web application and have that site collection use its own host header, instead of using the managed
path. You cannot create a site collection that uses a host header address (which Microsoft calls a
host-named site collection) in Central Administration; it can be done only at the command line or
in PowerShell. To start, we’ll see how it works in STSADM.
Note that in order to use the STSADM command, you need to be logged in as a user with permission
to access and edit the content databases in SQL Server.
Using STSADM, the command to create a new site collection normally is as follows:
STSADM -o createsite -url http://server/sites/newsite -owneremail name@domain
.com -ownerlogin DOMAIN\username
Other switches, such as -sitetemplate to prespecify the top-level site’s template, are covered
in Chapter 14.
Therefore, if I wanted to create a new site called http://spf2/sites/camper without using a
host header and using the http://spf2 web application with shareadmin as the owner, I would
use the following command:
STSADM -o createsite -url http://spf2/sites/camper -owneremail shareadmin@
dem0tek.com -ownerlogin dem0tek\shareadmin