簡體   English   中英

IIS兩次重寫URL?

[英]IIS Rewrite url twice?

我有一個網址'/ quote / details / e4dd5f4e4c705436ba381b0dc06fccc0'重寫為:'/ quote / details /?retrieveQuote = e4dd5f4e4c705436ba381b0dc06fccc0'

<rule name="Rewrite Saved Quote to Query String Type" stopProcessing="false">
    <match url="^quote/details/([^/]+)/?$" />
    <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    </conditions>
    <action type="Rewrite" url="quote/details/?retrieveQuote={R:1}" appendQueryString="true" />
</rule>

之所以有效,是因為當我將stopProcessing設置為true時,我得到了帶有正確輸出的404:請求的URL引號/詳細信息/?retrieveQuote = e4dd5f4e4c705436ba381b0dc06fccc0

現在,應使用以下方法像站點的其余部分一樣對此進行重寫:

<rule name="Rewrite to Index" patternSyntax="Wildcard" stopProcessing="true">
    <match url="*" />
    <conditions>
        <add input="{URL}" pattern="/admin/+" ignoreCase="false" negate="true" />
        <add input="{URL}" pattern="/api/+" ignoreCase="false" negate="true" />
        <add matchType="IsFile" negate="true" />
        <add matchType="IsDirectory" negate="true" />
    </conditions>
    <action type="Rewrite" url="index.php" appendQueryString="true" />
</rule>

但是由於某種原因,它不會,如果我使用$ _SERVER ['REQUEST_URI'],它會打印:quote / details / e4dd5f4e4c705436ba381b0dc06fccc0,但應該是:quote / details /?retrieveQuote = e4dd5f4e4c705436ba381b0dc06fccc0

任何想法如何使其正常工作?

我找不到任何解決方案,因此我創建了路由規則,並從URL中拆分了所需的參數。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM