【问题标题】:URL rewriting to another sub domainURL重写到另一个子域
【发布时间】:2019-07-02 03:59:48
【问题描述】:

我正在尝试创建要发送的 URL 重写规则:

www.mycompany.com/file.aspx?someQueryString

www.mycompany.com/fileXYZ.aspx?someQueryString

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

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

我写了这条规则:

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

匹配表达式似乎有效,但目标无效?怎么了?

【问题讨论】:

标签: asp.net iis url-rewriting


【解决方案1】:

感谢 Lex Li,我用你提供的测试 aspx 文件做了很多测试,发现了一个有效的规则:

<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>

【讨论】:

    猜你喜欢
    • 2021-10-22
    • 2018-07-28
    • 1970-01-01
    • 1970-01-01
    • 2018-10-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多