How to properly change the Host Header URL of a web application in SharePoint 2010


I’m baaaaackkkkkkk,  lol.   I apologize for taking about a 6 month break but I’m back and will have some new fresh blog content starting now.   I recently ran into an interesting scenario with a request to change the Host Header URL of a web application in SharePoint 2010.   I was surprised that I didn’t find much out on TechNet or any Microsoft publications on how to accomplish this properly for SharePoint 2010 which is the purpose of this blog.  First, let’s describe what it means to create a host header web application.   When you create a web application you have the ability to add a host header url.

initialcreate

 

In the above screenshot, I created a web application with a host header URL of RussMaxOriginalHost.   After creating the web application and site collection, I browse to the IIS Site and look at the bindings and the Host Header is added automatically which is expected.

image

 

Also, If I check Alternate Access Mappings in Central Admin I see the default zone is populated with my host header URL for the given web application

image

 

And finally, browsing to the site after creating the site collection renders the site with the specified host header.

image

 

What happens when I need to change this host header URL value?   My original thought was to simply go edit the bindings of IIS and change the alternate access mapping.   This actually works but isn’t recommended because eventually the bindings in IIS will be overwritten by the original host header URL.  

For Example:

Going to Central Administrator, Services on Server, and stopping and starting the Microsoft SharePoint Foundation Web Application service for the specified server will overwrite any manually updated host header entry in IIS/Site bindings with the original host header URL. 

or

Adding a new SharePoint Server to an existing farm will get the site with the original host header URL after Microsoft SharePoint Foundation Web Application service is started which happens automatically via PSConfig.

 

Explanation

When you create a web application and specify a host header URL, you stamp the host header URL on the spwebapplication object which is stored in the objects table in the configuration database.   When you try to change the host header URL by updating the Alternate Access Mapping and manually update the bindings in IIS, the SPWebApplication object is never updated so it continues to maintain knowledge of the original host header URL and not the new one.   When you start the Microsoft SharePoint Foundation Web Application service in Central Admin, the information from the associated SPWebApplication object in the configuration database is used when instantiating IIS Sites.  This is why the original host header URL shows up.

 

 

Options

The best automated way to update the Host Header URL on a web application is similar to the approach in SharePoint 2007 which is to un-extend and re-extend the Web Application.   That is, disassociate any connection with the existing IIS site and re-establishing that association.   Steps are the following assuming I’m changing my host header URL from russmaxoriginalhost to russmaxnewhost.     

1.  Go to Central Administrator, Application Management, Select the Web Application you wish to change and hit the arrow under Delete and choose  Remove SharePoint from IIS Site.

 

clip_image002

           

2. Next, select the associated site you which to update the host header URL against.    For Delete IIS web sites, select No and hit OK.

image

    

Note:  If you have more than two IIS sites available, that means your web application is extended so choose the appropriate Zone/IIS Site that you would like to update.

           

3. Go to Central Administrator, Application Management, Select the same Web Application and choose Extend button on the ribbon.

 

4. Choose Use an exisitng IIS Site and choose the original site from Step 2 above.   Specify the New Host Header URL and any other settings that should match.  In my case, I updated the Host Header to RussMaxNewHost and hit OK here.

image

 

After updating DNS, the site comes up with no problems.

image

 

 

Question:   What if the web application is already extended to another zone let’s say extranet zone and you want to change host header URL for the default zone?

Answer:  This will still work fine since your only making changes to the IIS site associated with the default zone, the site hosting the extranet zone will remain untouched and should continue to work fine after the above changes.

 

Question:   How can I validate the associated SPWebApplication object in the configuration database contains the new host header URL?

Answer:   You can run the following Power Shell to validate.   Here is a sample:

$wa = get-spwebapplication “http://randomURL”
$iissettings = $wa.GetIisSettingsWithFallback("Default")
$iissettings.serverbindings

This will output the host header URL for the default zone for the web application of your desired URL.

 

Thanks,

Russ Maxwell, MSFT 


Comments (29)

  1. Nilesh says:

    This blog helped me a lot.

    Although with the above steps, I also changed the DNS settings and registry changes for BackConnectionHostnames.

    However, after restarting the server, there are two bindings on IIS Site now. It did not remove the old one.

  2. Nilesh says:

    Thank You a lot!!

  3. RyanS. says:

    Hi Russ,

    Is there a way to execute the above steps without extending the web application?

    We want to use a single zone (single url) but we are finding after running a config wizard or deployment of wsps the bindings on the IIS servers are going back to where they were before.

    Is there a way to update the serverbindings properly using powershell without using the extend the web app procedure used above.

    Any assistance is greatly appreciated.

    Thanks,

    Ryan

  4. Marcow says:

    Thanks a lot, works great with HTTPS web apps too

  5. Robert J. says:

    Russ,

    If you perform these steps on a webapp with only one zone all the solutions deployed to the webapp will be dissociated. Re-deploying them often causes issues because features might already be activated.

    The only trick I found to work around this was to extend the webapp to a temporary iis site, then perform the steps you described on de default zone and after that I deleted the temporary iis site. This way the solutions will remain deployed according to the UI.

    Any thoughts on this?

    Thanks,

    Robert

  6. Russ Maxwell says:

    Hey Robert,

    I suspect you are correct.  The blog itself doesn't take into consideration custom deployed solutions.  I think that's certainly worthy of noting that you will likely have to jump through additional hoops if you require to unextend and re-extend the web application.  This is why I'm hopeful this blog will be read prior to Admins deploying SharePoint which would avoid having to go through these steps of unextend/re-extend the webapp.  I'll probably drop a note in the blog noting the custom solutions aspect.  Thanks for bringing it to my attention.

    Russ

  7. haritha says:

    Hi,

    I have a site developed in share point services.i extended that site to internet.But in that site,when i am trying to signing it's URL is coming with internal site port number.

    ex: my internal site is http://moss:2345/ my external site it http://mysite.com/ but it's url is coming as http://mysite.com:2345/ .

    Please let me know the reason and solution for the problem.

  8. I'm having some trouble with SharePoint host headers and this is actually quite useful in getting my head around them.  Thanks for posting.

  9. Sagir Kazi says:

    Hey Russ,

    This blog really helped me but I ran into few issues.

    1) Does this only work with default port (80)? I tried the steps with a website I had on port 1000 and the new url had :1000 appened to it.

    2) When I do step 1 & 2, I dont get to see my original IIS website when I try to do step 4. I got 1 WFE, 1 app server and 1 DB server farm. The IIS websites are only created on WFE and there are no websites created in IIS of App server.

    Any idea what am I doing wrong here? Thanks for your help.

  10. Sagir Kazi says:

    Hey Russ,

    This blog really helped me but I ran into few issues.

    1) Does this only work with default port (80)? I tried the steps with a website I had on port 1000 and the new url had :1000 appened to it.

    2) When I do step 1 & 2, I dont get to see my original IIS website when I try to do step 4. I got 1 WFE, 1 app server and 1 DB server farm. The IIS websites are only created on WFE and there are no websites created in IIS of App server.

    Any idea what am I doing wrong here? Thanks for your help

  11. Tom says:

    Thanks for the solution, works great. I've tried the first solution (changing the IIS bindings), but in my case I didn't help. Good luck everyone and keep on posting 😉

  12. JK says:

    This totally screwed my setup. I was planing to "convert" my site to use SSL. So I did install a certificate to IIS and did this using different URL and host names. Changed AAMs to the default zone. Now the site is unusable and tried to delete-extend back to use port 80 but no luck. Now I can't access the site. Though it asks authentication when I try but the website is not found.

  13. Russ Maxwell says:

    @JK, my guess is that you have something misconfigured. Can you provide more details into the steps you went through?

  14. Host named site collections. says:

    can you please shed some light on how we can do this for host named site collections. MS documented that not use host names at iis level. but what if i have multiple web apps with host named site collections? what if i have vanity sites on those web apps?

    i understand that manual modification will not be recorded in SP but still things are going well with host names then why MS saying that its impossible to access host named sites with host names….. confusion ???

  15. John Wade says:

    Instead of using machinename.domain.net we want to use DNS entry sharepointtest.domain.com

    I followed you process.  Not I get to the sign-in page with DNS URL but when I sign-in I get http 500 error.

    I am using Windows Authentication to test instead of Token Authentication.  Can you suggest what I may need to do please to resolve this http 500.

  16. Radhika says:

    Thanks for posting and a great explanation indeed.

  17. Umar says:

    Great article, as you said in your explanation section, removing IIS binding manually from IIS is not safe. I verify this , these entries do exist in config data base and can cause issue with future updates or restart service. but at the same time TechNet article says ""Edit the IIS web site binding manually to remove the host header binding that was created when the web application was created and replace this with an IP address binding."" at technet.microsoft.com/…/cc424952(v=office.15).aspx

    I think you are right it should not be removed manually but would like your thoughts on it. This is for host header site set up by the way.

    Thanks again for the great article.

  18. Prakash says:

    Hi, we have a attribute called employeeNumber. How can i replace this with the windows user account? i changed all sAMAccountName to employeeNumber, but its showing as a new account.

    Please Help!

  19. Spuser says:

    Hello Russ,

    Is there any supportability aspect of the name of host header in the web application. Like can we host header name as https://ab.bc.cd.gov

    and how much the same is supported.

  20. Sathya says:

    Thank you!!  It helps to understand easily..

  21. Spex5 says:

    I accidentally did this on my CA web app.  CA is not functional anymore.  Please see the stackexchange post.

    sharepoint.stackexchange.com/…/sharepoint-2013-restoring-central-administration

  22. JB says:

    This worked perfectly for my environment! I migrated from SBS2003 (WSS2) to Server 2012 with SharePoint Foundation 2010. I wanted to keep the same hostname all my users knew (companyweb) and this article helped greatly! Thank you!!

  23. JZ says:

    The instructions were written well and easy to follow and understand, unlike the other MS documentation on SharePoint. Followed instructions and was not able to connect because the site was not recognized. Any suggestions for an isolated server using SharePoint Foundation 2013, not on a domain/dns and not a .com extension? Flushed DNS, just to be sure, cleared cache, and iisreset. Used the original name in the URL for the site and was still able to connect even after going through process of changing host header. hmm. Changed host header from svr2012 to sharepoint.

  24. Vstar19 says:

    Hi. Thanks for this. I had an issue in SP13.

    I extended a zone onto HTTPS, this as expected created an additional IIS Site, and I had 2 urls to access my data.. One over http:// and the other over https://

    I attached the certificate to https://. and everything was working fine.

    The suddenly, my search stopped working, I kept getting a 'Default Content Access Account – Access Denied' I tripled checked and default content access account & it defo have full read to the web app…

    Only after a few hours – I noticed that the http site in IIS did not have any bindings associated. I Simply added the binding to the iis site and now everything works fine. (the binding was already added to https:)

    QUESTION is why do you need the binding in IIS to the http site?, is it only required when you extend a zone? Why would me adding the binding to the iis site resolve the default content access account?

    Thanks in advance to help on this.

  25. Vaibhav says:

    Nice blog.. Thank you..

  26. SharePoint Online Training says:

    It is incredible and informative knowledge. Impressive.

    <a href="http://staygreenacademy.com">SharePoint Online Training</a>

  27. Mohamed AbdelSattar says:

    I believe one one more steps will needed, you'll need to run the configuration wizard.

  28. Baso says:

    I am creating Web Application with Host name then creating site collection the same way appears above in the article, but when browsing the URL and after put the credentials, the credentials denied,

    the same credentials on different website in the same dev env working fine.

    What else we should look for beside AMM and Site collection Administrators to browse hotnamed site.

Skip to main content