简体   繁体   中英

URL rewriting to another sub domain

I am trying to create an URL Rewrite rule to send :

www.mycompany.com/file.aspx?someQueryString
or
www.mycompany.com/fileXYZ.aspx?someQueryString

to

www.subdomain.mycompany.com/file.aspx?someQueryString
or
www.subdomain.mycompany.com/fileXYZ.aspx?someQueryString

I wrote this rule:

<rule name="MyPageRewrite" stopProcessing="true"> <match url="(.*)(file[a-zA-Z]*\\.aspx)" /> <action type="Rewrite" url="http://subdomain.mycompany.com/{R:1}" /> </rule>

The match expression seems to work, however the destination doesn't? What is wrong?

Thanks Lex Li, I did many tests with the test aspx file you provided and found a rule that works:

<rule name="MyPageRewrite" stopProcessing="true">
   <match url="(.*)(file[a-zA-Z]*\.aspx)" />
   <action type="Redirect" redirectType="Found" url="http://subdomain.mycompany.com/{R:0}" appendQueryString="true"/> 
</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.

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