When we deal with Web Application URLs in SharePoint Environment it is quite important to review the URL Structure. By default when we create any SharePoint Web Application, it takes server name as default while preparing the URL structure as follows-
http:// <Server Name>:<Port>
Using Host Header we can overwrite this default behavior of comprising Web Application URL by SharePoint Engine.
In this article we will look for the Steps to create Web Applications with Host Headers.
If we look for the Web Application List created we can see only two Web Applications created as shown in the figure below:
If we closely look for Web Application SharePoint -80 which has been created with defaults and that is why if you see to the URL you will notice the URL structure is http:// <Server Name>:<Port>
Now in order to create the Host Header based Web Applications we need to follow the below steps:
Add DNS Entry for Host Header
- Search for DNS on Windows Server
- Right Click on the Domain Name
- Choose New Host
- Specify the Name Host Header
- Specify IP address to the Server
- Click Add Host Button
Create Web Application Using PowerShell
As we know that default Authentication Mode for a Web Application is Classic when it is created using PowerShell. But here we have to create a Web Application in Claims Based Authentication Mode and that is why it is necessary to initialize the authentication provider by calling New-SPAuthenticationProvider command which return a fresh object referring Claims Based Authentication
$authenticationProvider = New-SPAuthenticationProvider
Then we need to call for New-SPWebApplication command to create a new Web Application utilizing Host Header as below-
New-SPWebApplication -Name “Development – Portal” -Port 2016 -HostHeader “developmentportal.PRASHANT.LOCAL” -URL “http://developmentportal.PRASHANT.LOCAL” -ApplicationPool “SharePoint – 2016” -ApplicationPoolAccount (Get-SPManagedAccount “Prashant\Administrator”) -AuthenticationProvider $authenticationProvider
Once we get this PowerShell command executed using SharePoint Management Shell successfully, we can see the details of the new Web Application created just now
Similarly we can go back to Central Administration to look for List of Web Applications and can be able to locate this newly created Web Application
It is important to note the URL of the newly created Web Application and see the Host Header is now present in the Web Application URL Structure as needed.
And we are done!!
Hope you find it helpful.