Quantcast
Channel: AutoSPInstaller
Viewing all articles
Browse latest Browse all 2279

Commented Issue: Defining HNSC under a managed path will add it to the hosts file [20932]

$
0
0
When specifying a host named site collection to be created which are located under a managed path, AutoSPInstaller will add the complete URL to the hosts file. I.e. when I use a HNSC scenario so I have to use HNSC to create site collections which reside under an URL which is not a physical web application and my host webapplication is hosted under https://sharepoint.zomers.eu and I want to create a site collection under https://www.zomers.eu/sites/something, I need to have it created as a HNSC. This works fine, however AutoSPInstaller will also add www.zomers.eu/sites/something to the hosts file of Windows while this has no function. It should only add the HNSC to the hosts file if it is not under a managed path, so i.e. www.zomers.eu is fine.
Comments: ** Comment from web user: KoenZomers **

I just figured out using Authority isn't the best option as this would add the port number when it deviates from the defaults 80 and 443. Not something we can use in the hosts file. So better to use:

```
Get-SPSite -Limit All | % { ($_.Url -as [System.URI]).Host} | Sort-Object -Unique | % { "127.0.0.1`t$_" | Out-File -PSPath $env:windir\system32\drivers\etc\hosts -Append -Encoding UTF8 }
```


Viewing all articles
Browse latest Browse all 2279

Trending Articles