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