Subin Jacob
Subin Jacob

Reputation: 4864

How can I map A directory of Main Application as another domain?

I want to set www.domain.com/folder as folder.domain.com. Both must run as same application.

Upvotes: 1

Views: 154

Answers (1)

Parag Meshram
Parag Meshram

Reputation: 8521

Add following rule in your web.config file -

<system.webServer>
    <rewrite>
      <rules>    
         <rule name="FolderSubDomain" stopProcessing="false">
           <match url="(.*)" />
             <conditions>
               <add input="{HTTP_HOST}" pattern="^(?!www)(\w+)\.domain\.com$" />
             </conditions>
             <action type="Rewrite" url="{C:1}/{R:1}" />
           </rule>
     </rules>
   </rewrite>
</system.webServer>

Upvotes: 1

Related Questions