简体   繁体   中英

Rewrite rule works perfect, but I don't want to rewrite www

I have this rewrite rule which rewrite demo.mydomain.com to mydomain.com/myform.aspx?url=demo.

 <rewrite>
 <rules>
 <rule name="domain redirect" stopProcessing="true">
  <match url="^(.*)$" />
  <conditions trackAllCaptures="true">
<add input="{HTTP_HOST}" pattern="^(.+)\.mydomain\.com$" />
  </conditions>
   <action type="Rewrite" url="{REQUEST_URI}/myform.aspx?url={C:1}" appendQueryString="true" />
 </rule>
</rules>
</rewrite>

My problem is that http://www.mydomain.com is rewrited too. How can I exclude www in my rewrite rule?

 <add input="{HTTP_HOST}" pattern="^[^(www)](.+)\.mydomain\.com$" />

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM