I want to create a rewrite rule on web.config like subdomain.domain.com to www.domain.com/abc/xyz and keep the url subdomain.domain.com on browser bar. How can I do that? I tried a lot of configurations but seems that this is not possible.
Below is a example that i tried:
<rewrite>
<rules>
<rule name="SubDomain" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^(?!www)(\w+)\.domain\.com$" />
</conditions>
<action type="Rewrite" url="http://www.domain.com.com/abc/xyz" />
</rule>
</rules>
</rewrite>-->
This should work:
<rule name="SubDomain" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="(.*).domain.com" />
</conditions>
<action type="Rewrite" url="/abc/xyz" />
</rule>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.