We will talk about how to point a subdomain to a subfolder using URLRewrite. Now, learn the detailed steps in below.
1. Log into WebSitePanel and add a specific subdomain.
2.Set the specific sub-domain as a site pointer under your primary domain name in the Web Site Properties.
3.you need to mark the sub folder as an application.(Create Virtual Dirs in the Web Site Properties ).
4.Add these codes into your web.config files.
<rewrite>
<rules>
<rule name=”test2″>
<match url=”.*” />
<conditions>
<add input=”{HTTP_HOST}” pattern=”^ your sub domain name$” />
<add input=”{PATH_INFO}” pattern=”^/sub-folder/” negate=”true” />
</conditions>
<action type=”Rewrite” url=”\sub-folder\{R:0}” />
</rule>
</rules>
</rewrite>
Note:
- For the rule name, enter your domain name, or whatever makes the most sense to you.
- Make sure that when you browse to the website by domain name, both of your domain name (primary & sub-domain)resolve to the correct IP address.