>
>
>
>
When you need to host a subdomain like mysite.mydomain.com
that points to an existing IIS site http://www.mydomain.com/mysite
, you'll need to perform both DNS and IIS configuration. Here's the complete technical process:
>
>
>
>
Before proceeding, verify:
>
>
1. DNS record exists (A or CNAME record for mysite.mydomain.com)
>
>2. You have administrative access to IIS Manager
>
>3. The original site (www.mydomain.com/mysite) is functioning properly
>
>
>
>
The core configuration happens in IIS bindings:
>
>
-
>
- Open IIS Manager
- Right-click your site → "Edit Bindings"
- Click "Add"
>
>
>
>
>
>
>
>
>
Example binding configuration:
>
>
Type: http
>
>Host name: mysite.mydomain.com
>
>Port: 80
>
>IP Address: All Unassigned
>
>
>
>
For automation or scripted deployments, use AppCmd:
>
>
%windir%\system32\inetsrv\appcmd.exe set site /site.name:"Your Site Name" /+bindings.[protocol='http',bindingInformation='*:80:mysite.mydomain.com']
>
>
>
>
After configuration:
>
>
1. Run: ping mysite.mydomain.com (verify DNS)
>
>2. Check IIS logs (%SystemDrive%\inetpub\logs\LogFiles)
>
>3. Test with curl: curl -I http://mysite.mydomain.com
>
>
>
>
If the subdomain doesn't work:
>
>
-
>
- Clear DNS cache:
ipconfig /flushdns
- Check binding order in IIS
- Verify firewall allows port 80 traffic
>
>
>
>
>
>
>
>
>
>
>
For production environments:
>
>
- Implement proper authentication
>
>- Consider HTTPS binding
>
>- Restrict IP access if needed
>
>- Set appropriate permissions
>
>
When working with IIS 7, setting up a subdomain requires coordination between DNS configuration and IIS bindings. Let's break down the process for converting http://www.mydomain.com/mysite
to http://mysite.mydomain.com
.
Before proceeding, ensure you have:
- DNS A record pointing
mysite.mydomain.com
to your server IP - Administrative access to IIS Manager
- Existing site with content at
www.mydomain.com/mysite
Open IIS Manager and follow these steps:
1. Right-click "Sites" → "Add Web Site" 2. Enter site name: "mysite.mydomain.com" 3. Set physical path to your existing content folder 4. For binding: - Type: http - IP address: "All Unassigned" - Port: 80 - Host name: "mysite.mydomain.com" 5. Click OK
If you want to keep the existing site structure:
1. Right-click your current site → "Edit Bindings" 2. Click "Add" 3. Set: - Type: http - IP address: same as current - Port: same as current (typically 80) - Host name: "mysite.mydomain.com" 4. Click OK
After setup, test your configuration:
- Clear DNS cache with
ipconfig /flushdns
- Test in browser with
http://mysite.mydomain.com
- Check IIS logs for requests to the new binding
If the subdomain isn't working:
- Verify DNS propagation with
nslookup mysite.mydomain.com
- Check IIS bindings for conflicts
- Ensure the application pool is running
- Review Windows Firewall settings
For production environments, consider adding:
<system.webServer> <rewrite> <rules> <rule name="Redirect to subdomain" stopProcessing="true"> <match url=".*" /> <conditions> <add input="{HTTP_HOST}" pattern="^www\.mydomain\.com/mysite$" /> </conditions> <action type="Redirect" url="http://mysite.mydomain.com/{R:0}" /> </rule> </rules> </rewrite> </system.webServer>
This URL rewrite rule automatically redirects visitors from the old path to the new subdomain.