Reputation: 946
I want anySubdomain.mydomain.com to behave as mydomain.com/anySubdomain. My configs so far:
I created an inbound rule in URL Rewrite module of web site in IIS as:
<rewrite>
<rules>
<rule name="Subdomain to Folder" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="[http://]*(.*).mydomain.com" />
</conditions>
<action type="Rewrite" url="{C:1}/{R:1}" logRewrittenUrl="false" />
</rule>
</rules>
I created a folder under root folder as anySubdomain and put an index.html into it. I have checked that mydomain.com/anySubdomain gets the page that I want.
I receive a 404 page when I call anySubdomain.mydomain.com. I know this is a common issue but I could not solve this problem, where is my mistake? Thanks.
Upvotes: 0
Views: 1181
Reputation: 946
Finally got the answer, let me share it. The missing step was to add following IIS binding to catch all "has not yet assigned hostnames requests":
IP Address: IP of web server
Port: 80
Host: (Leave Blank)
Upvotes: 1