簡體   English   中英

URL 重寫模式 iis 10

[英]URL rewrite Pattern in iis 10

我正在使用 Asp.Net web forms。在我的 URL 中,我不想在字符“?”之后公開。 我希望正則表達式模式使用 IIS 10 來實現這一點。我試過這個“Security(.+)$”,但它不起作用。

來自: www.some.com/Security/login.aspx?name=dfdf ?name=dfdf

對此: www.some.com/Security/login.aspx

如果您不想公開查詢字符串。

1.您應該將任何請求重定向到www.some.com/Security/login.aspx?name=dfdfwww.some.com/Security/login.aspx

2.然后您必須將來自www.some.com/Security/login.aspx的請求重寫回www.some.com/Security/login.aspx?name=dfdf

請記住,此規則只能重寫回 static 查詢字符串?name=dfdf。

如果需要動態重寫URL,則可能需要添加自定義請求header來保存查詢字符串。 這樣后端服務器就會知道它應該在哪里重寫。

   <rules>
                <rule name="redirect rule" enabled="true" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{REQUEST_URI}" pattern="^/Security/login.aspx\?(.+)" />
                    </conditions>
                    <action type="Redirect" url="Security/login.aspx" appendQueryString="false" redirectType="Temporary" />
                </rule>
                <rule name="rewrite back" stopProcessing="true">
                    <match url="(.*)" />
                    <conditions>
                        <add input="{REQUEST_URI}" pattern="^/Security/login.aspx$" />
                    </conditions>
                    <action type="Rewrite" url="Security/login.asp?name=dfdf" appendQueryString="false" />
                </rule>
            </rules>

暫無
暫無

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

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