« Previous Next »

Thread: host headers mapping to virtual folders/applications

Last post 11-10-2009 1:01 AM by Leo Tang - MSFT. 4 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (5 items)

Sort Posts:

  • 11-06-2009, 5:33 AM

    • rkr31
    • Top 200 Contributor
    • Joined on 05-01-2007, 10:15 AM
    • Posts 30

    host headers mapping to virtual folders/applications

    Hi

    I need to find a way of mapping host headers to a sites virtual folder/application.

    i have a site called domain.com on c:\inetpub\mywebsite

    I want to automagically direct everything from docs.domain.com to c:\inetpub\mywebsite\docs

    is there a way of doing this natively within iis or would i have to use url rewrite or something?

    Thanks

    Richard

  • 11-06-2009, 6:14 AM In reply to

    Re: host headers mapping to virtual folders/applications

    Hi,

    One way to do this is to create a separate web site in IIS with a host header of docs.domain.com and configure its root folder to be c:\inetpub\mywebsite\docs

    Configure a Host Header for a Web Site (IIS 7)

    Regards,

    Paul Lynch | www.iisadmin.co.uk
  • 11-06-2009, 7:41 AM In reply to

    • rkr31
    • Top 200 Contributor
    • Joined on 05-01-2007, 10:15 AM
    • Posts 30

    Re: host headers mapping to virtual folders/applications

    yeah i got that but really want to move away from having a separate site configured for a simple subdomain.

    Thanks for the response though.

  • 11-09-2009, 4:00 AM In reply to

    • rkr31
    • Top 200 Contributor
    • Joined on 05-01-2007, 10:15 AM
    • Posts 30

    Re: host headers mapping to virtual folders/applications

    No other ideas anyone?

    I just checked my old go daddy windows hosting account and they have been doing this for ages so it myst be possible.....

  • 11-10-2009, 1:01 AM In reply to

    Re: host headers mapping to virtual folders/applications

    Hi,

    This can be archived  by using  URL rewriting, you can try the following rule

    <rewrite>
          <rules>
            <rule name="Redirect to sub directory" stopProcessing="true">
              <match url=".*" />
              <conditions>
                <add input="{HTTP_HOST}" pattern="^docs.domain.com$" />
              </conditions>
              <action type="Redirect" url="http://domain.com/docs/{R:0}" redirectType="Permanent" />
            </rule>
          </rules>
    </rewrite>

    For more information about URL rewriting, please refer to:
    Using URL Rewrite Module
    http://learn.iis.net/page.aspx/460/using-url-rewrite-module/

    Leo Tang
    Microsoft Online Community Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Page 1 of 1 (5 items)
Microsoft Communities