簡體   English   中英

設置 URL 重定向/重寫數字

[英]Setup URL redirection/rewrite for numbers

如果我有一個托管在 IIS 上的域名,例如“example.com”。 如何設置任何帶有數字參數(例如 example.com/)的 URL 請求將被重定向到 example.com/function/trigger/? (其中“函數/觸發器”是硬編碼路徑)

這樣做的方法是什么? In my index.html, I could add a Javascript function that during load looks for a numeric parameter in the URL and then via javascript calls a redirect method. 但是,用戶需要在重定向之前查看/閃爍 index.html。 我希望這是即時的,並且不承認發生了重定向。

我不清楚你想做什么,但我認為可以通過 url 重寫來完成,不需要使用 javascript。

<rule name="rule" stopProcessing="true">
                <match url="^index/([0-9a-z]+)/([_0-9a-z]+)" />
                <action type="Redirect" url="/function/trigger" />
</rule>

它可以匹配所有包含數字參數的 url,然后將其重定向到 example.com/function/trigger/。

如果我對您的需求有任何誤解,您可以向我展示一些示例 url 並重定向 url 以便我可以幫助您。

暫無
暫無

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

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