Skip to content

Update a web application URL and IIS bindings for SharePoint

July 15, 2017

 Update a web application URL and IIS bindings for SharePoint 

A quick Google search gave me this but below is just another way to make it easier using power shell with less clicking. This applies to SharePoint 2010, 2013 and 2016.  

https://technet.microsoft.com/en-us/library/cc262366.aspx  

Scenario:

Let’s say you created a web application http://danger for your users and they are working on it and site is live, all good. One fine morning site owner decided this name is not good and want to change the URL to something else like http://ranger

You can change URL from Central Administration and in case you don’t want to click too much you can use the 4 liner PowerShell at the end of this write.

Using Central Administration:  

Extend the web application to a zone that is not used yet. Let’s say “Custom” zone. 

You can enter any host header value for example “tempsite” as this will be temporary extension of web app with any port number, we will get rid of this zone once done.  

Once web application is extended, you can confirm that by going to Alternate Access Mapping page, you will see a new mapping http://tempsite in zone you used while extending.

Go back to Manage Web Application page high light web application http://danger by clicking on it and click on tiny drop down on the Delete button in the ribbon. Select “Remove SharePoint from IIS Web Site”, Select zone from the drop down with unwanted URL in this case its “danger”, check box for delete IIS web site and click ok.  

So far, we have removed the unwanted URL and move everything over to a new URL called tempsite. Go back and extend the web application again and this time enter the correct URL http://ranger , port 80 and make sure you select Default zone from the drop down. Hit ok. Once done check your site with new URL, in this case http://ranger .  

You can remove the custom Zone URL as mentioned earlier using “Remove SharePoint from IIS Site” option.

Using Power Shell

Add-PSSnapin Microsoft.sharepoint.powershell 
$Auth=New-SPAuthenticationProvider
Get-SPWebApplication -Identity http://danger | New-SPWebApplicationExtension -Name TempSite -Zone Custom -Port 80 -HostHeader TempSite -Url http://tempsite -AuthenticationMethod NTLM -AuthenticationProvider $Auth 

Get-SPWebApplication -Identity http://danger | Remove-SPWebApplication -Zone Default -DeleteIISSite -Confirm:$false  

Get-SPWebApplication -Identity http://danger | New-SPWebApplicationExtension -Name Ranger -Zone Default -Port 80 -HostHeader sandy -Url http://ranger -AuthenticationMethod NTLM -AuthenticationProvider $Auth -Confirm:$false 

Get-SPWebApplication -Identity http://ranger
| Remove-SPWebApplication -Zone Custom -DeleteIISSite -Confirm:$false

Change the parameters as per your requirements. If you want you can add “sleep –seconds 5” after each command for IIS web site to be crated on each server, but it all depends how big environment is. 

Update Web Application Name 

Above command will update the URL but notice web application name is still the same “SharePoint –Danger”. To change Web Application name, use the following script.

$WApp= Get-SPWebApplication -Identity http://ranger  
$WApp.Name=”SharePoint – Ranger” 
$WApp.Update() 

Get-SPWebApplication 

 HTH

Advertisements
Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: