Wild card sub domain configurations in a web server software allow redirection of all non-existent sub domains to a main domain. In other words, if a user types an invalid sub domain name in a browser, the web server automatically redirects the request to the preferred domain. This feature was not available in IIS until Microsoft IIS 10.
The following sections illustrate the steps for deploying wild card sub domains in IIS 10 in various site configurations.
I. Configuring a new website with a wild card sub domain:
- Open Internet Information Manager, and select the server in which the domain exists.
- Go to the ‘Add Website’ option from the right pane.
- Now enter the details of your website, and add the wild card host header in the ‘Host name’ box.
Your website is now configured with wild card sub domains.
II. Configuring wild card header for an existing domain:
- Open Internet Information Manager and select the server in which the domain exists.
- Go to the domain for which the wild card header is to be configured.
- Now select the ‘Bindings’ option from the right pane.
- Select the appropriate bindings from the list (http, https etc.) and choose the ‘Edit’ option.
- Now enter the wild card entry in the ‘Host name’ field, and click ‘OK’ to finish the configuration
III. Adding a wild card host header to an existing site via PowerShell
You can easily add a wild card host header to an existing domain via PowerShell using the Set-WebBinding module
Import-Module WebAdministration; Set-WebBinding -Name "example.com" -HostHeader "example.com" -PropertyName "HostHeader" -Value "*.example.com"
Thanks for dropping by. Ready for the next blog?