简体   繁体   English

iis重写保持路径(保留文件名以外的所有内容)

[英]iis rewrite keep path (keep everything but the file name)

attempting to re route 试图重新路由

https://xxxxx.aaa.bb.cc.dd/FOB_Main.aspx?FOB=O to https://xxxxx.aaa.bb.cc.dd/FOB_Main.aspx?FOB = O
https://xxxxx.aaa.bb.cc.dd/FOB_Main_Rewrite.aspx?FOB=O https://xxxxx.aaa.bb.cc.dd/FOB_Main_Rewrite.aspx?FOB = O

and

https://xxxxx.aaa.bb.cc.dd/testdev/FOB_Main.aspx?FOB=O to https://xxxxx.aaa.bb.cc.dd/testdev/FOB_Main.aspx?FOB = O
https://xxxxx.aaa.bb.cc.dd/testdev/FOB_Main_Rewrite.aspx?FOB=O https://xxxxx.aaa.bb.cc.dd/testdev/FOB_Main_Rewrite.aspx?FOB = O

and

https://xxxxx.aaa.bb.cc.dd/net/prodmirror/FOB_Main.aspx?FOB=O to https://xxxxx.aaa.bb.cc.dd/net/prodmirror/FOB_Main.aspx?FOB = O
https://xxxxx.aaa.bb.cc.dd/net/prodmirror/FOB_Main_Rewrite.aspx?FOB=O https://xxxxx.aaa.bb.cc.dd/net/prodmirror/FOB_Main_Rewrite.aspx?FOB = O

so retain everything before an aspx page and the query string. 因此,请保留aspx页面和查询字符串之前的所有内容。 and replace it with a new aspx page. 并将其替换为新的aspx页。 (replace only the filename and keep everything else) (仅替换文件名,并保留其他所有内容)

here is my attempt. 这是我的尝试。

  <rule name="Fob_Main_decommisioned" stopProcessing="true">
    <match url="^fob_main.aspx" />
    <action type="Redirect" url="/FOB_Main_Rewrite.aspx" redirectType="Temporary" />
  </rule>

this is working fine for 这工作正常

https://xxxxx.aaa.bb.cc.dd/FOB_Main.aspx?FOB=O to https://xxxxx.aaa.bb.cc.dd/FOB_Main.aspx?FOB = O
https://xxxxx.aaa.bb.cc.dd/FOB_Main_Rewrite.aspx?FOB=O https://xxxxx.aaa.bb.cc.dd/FOB_Main_Rewrite.aspx?FOB = O

but it is changing. 但它正在改变。

https://xxxxx.aaa.bb.cc.dd/testdev/FOB_Main.aspx?FOB=O to https://xxxxx.aaa.bb.cc.dd/testdev/FOB_Main.aspx?FOB = O
https://xxxxx.aaa.bb.cc.dd/FOB_Main_Rewrite.aspx?FOB=O https://xxxxx.aaa.bb.cc.dd/FOB_Main_Rewrite.aspx?FOB = O

I also attempted 我也尝试过

<rule name="Fob_Main_decommisioned" stopProcessing="true">
        <match url="^fob_main.aspx" />
        <action type="Redirect" url="{HTTP_HOST}/FOB_Main_Rewrite.aspx" redirectType="Temporary" />
      </rule>

but now I am getting 但现在我越来越

https://xxxxx.aaa.bb.cc.dd/testdev/xxxxx.aaa.bb.cc.dd/FOB_Main_Rewrite.aspx?FOB=O https://xxxxx.aaa.bb.cc.dd/testdev/xxxxx.aaa.bb.cc.dd/FOB_Main_Rewrite.aspx?FOB = O

I also attempted 我也尝试过

<rule name="Fob_Main_decommisioned" stopProcessing="true">
    <match url="(^.*)fob_main.aspx" />
    <action type="Redirect" url="/{R:1}FOB_Main_Rewrite.aspx" redirectType="Temporary" />
  </rule> 

but I am back to 但我回到

https://xxxxx.aaa.bb.cc.dd/FOB_Main_Rewrite.aspx?FOB=O https://xxxxx.aaa.bb.cc.dd/FOB_Main_Rewrite.aspx?FOB = O

(it is removing the testdev again) (它再次删除了testdev)

interestingly using this rule 有趣地使用此规则

 <rule name="Fob_Main_decommisioned" stopProcessing="true">
         <match url="(^.*)fob_main.aspx" />
        <action type="Redirect" url="/{R:1}FOB_Main_Rewrite.aspx" redirectType="Temporary" />

and directly typing into the browser 并直接输入浏览器

https://xxxxx.aaa.bb.cc.dd/testdev/testdev/FOB_Main.aspx?FOB=O https://xxxxx.aaa.bb.cc.dd/testdev/testdev/FOB_Main.aspx?FOB = O

re routes me to the page I would like to go to. 重新将我路由到我想去的页面。

https://xxxxx.aaa.bb.cc.dd/testdev/FOB_Main_Rewrite.aspx?FOB=O https://xxxxx.aaa.bb.cc.dd/testdev/FOB_Main_Rewrite.aspx?FOB = O

This rule looks correct (if you placed this rule in root application): 该规则看起来正确(如果您将此规则放置在根应用程序中):

<rule name="Fob_Main_decommisioned" stopProcessing="true">
   <match url="(^.*)fob_main.aspx" />
   <action type="Redirect" url="/{R:1}FOB_Main_Rewrite.aspx" redirectType="Temporary" />
</rule> 

This rule will work, if you placed it in sub application: 如果将此规则放在子应用程序中,它将起作用:

<rule name="Fob_Main_decommisioned" stopProcessing="true">
    <match url="^fob_main.aspx" />
    <action type="Redirect" url="FOB_Main_Rewrite.aspx" redirectType="Temporary" />
</rule>

Most probably you back to https://xxxxx.aaa.bb.cc.dd/FOB_Main_Rewrite.aspx?FOB=O , because browser cached your wrong redirect before. 很可能您返回到https://xxxxx.aaa.bb.cc.dd/FOB_Main_Rewrite.aspx?FOB=O ,因为浏览器之前缓存了错误的重定向。 Can you please do this steps: 您能否执行以下步骤:

  1. Apply this rule 应用此规则
  2. Clear cache in your browser 清除浏览器中的缓存
  3. Try to open https://xxxxx.aaa.bb.cc.dd/testdev/FOB_Main.aspx?FOB=O 尝试打开https://xxxxx.aaa.bb.cc.dd/testdev/FOB_Main.aspx?FOB = O

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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