首页 > 解决方案 > 添加一个“?” 使用 IIS URL 重写

问题描述

我需要创建一个 URL 重写,以便当用户键入:mydomain.com/test123 时,服务器会得到:mydomain.com/?test123。

我试过这个:

<rule name="UF" stopProcessing="true"> <match url="example.com/([_0-9a-z-]+)" /> <action type="Redirect" url="https://example.com/?{R:1}" /> </rule>

标签: urlredirectiisurl-rewriting

解决方案


根据您的描述,我建议您可以尝试使用以下 url 重写规则。

            <rule name="UF" stopProcessing="true">
                <match url="([_0-9a-z-]+)" />
                <action type="Redirect" url="https://example.com/?{R:1}" appendQueryString="false" />
            </rule>

结果:

在此处输入图像描述


推荐阅读