Point a subdomain to a sub folder using URL Rewrite

Discussion in 'General troubleshooting' started by dlature, Jan 18, 2011.

  1. I used this example to create my own redirect script to try. I did all the steps in this thread, and now have this:

    <rewrite>
    <rules>
    <rule name="blogDir" enabled="true">
    <match url="(.*)" />
    <conditions logicalGrouping="MatchAny">
    <add input="{HTTP_HOST}" pattern="^wp.theoblogical\.org$" />
    </conditions>
    <action type="Rewrite" url="\wp222\{R:0}" />
    </rule>
    </rules>
    </rewrite>

    Where do I put this to activate it?
     
  2. You stick it in your web.config file inside the <system.webServer> tag.
     
  3. Web config file?

    I dn't have any web.config file. Is there a "blank" template with the section you mention already init, so I can do the insertion you mention? And in wha dir do I put it? In the app dir (/wp222 in this case) or in the root of my site?
     
  4. Ray

    Ray

    Use the IIS 7 Manager and the URL Rewrite module inside the IIS 7 Manager. When you start making changes there, IIS 7 will automatically set you up with a web.config file.

    A second method to get a web.config file is to build your web application using Visual Studio and the web application is created using a ASP.Net template. A web.config file along with other .Net folders will be automatically be created for you by your Visual Studio and you can upload those files and folders on our server. Either way will work.
     
  5. I am facing similar issue
    where will be web.config file go ? inside the subfolder or at the root ?

    this is the snippet from my web.config
    <rewrite>
    <rules>
    <rule name="subdomain.domain.org" stopProcessing="true">
    <match url=".*" />
    <conditions>
    <add input="{HTTP_HOST}" pattern="^subdomain.domain.org$" />
    <add input="{PATH_INFO}" pattern="^/subfolder_Prod/" negate="true" />
    </conditions>
    <action type="Rewrite" url="\subfolder_Prod\{R:0}" />
    </rule>
    </rules>
    </rewrite>
     
  6. Elshadriel

    Elshadriel Winhost Staff

    The web.config file with the URL Rewrite rules go in the root folder.
     

Share This Page