开发者

IIS 7 Redirect using conditions

I asked this question previously I think poorly - so here in a nutshell...

I have a chinese and australian site

First Redirect is good

http://mycompany.com/myproduct --> 开发者_开发问答http://mycompany.com/products/myproduct 

I also need this

http://mycompany.com/cn/myproduct --> http://mycompany.com/cn/products/myproduct

this expression matches the 1st and 2nd ^(cn|com)/myproduct/?

question is - under the action panel , what is the format of the Redirect Url to satisfy both?

something like Redirect Url: {R:0}/products/myproduct (this doesnt work..just for illustration)

cheers!

EDIT:

If this helps - here's the rule im having problems with in web.config

            <rule name="myproduct" stopProcessing="true">
                <match url="^(cn|com)/myproduct/?" />
                <conditions logicalGrouping="MatchAny" trackAllCaptures="true">
                </conditions>
                <action type="Redirect" url="{R:1}/products/myproduct" />
            </rule>


This should work.

<rules>
   <rule name="myproduct" stopProcessing="true">
     <match url="^([^/]{2,3}/)?myproduct(/$|$)" />
     <action type="Redirect" url="{R:1}products/myproduct" />
  </rule>
</rules>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜