[英]IIS matches the rule but IIS rewrite module says the rule doesn't match
我在我的網站上正確應用規則時遇到問題。
規則是:
(^((?!\/bundles\/).)*[^\/]$)
該操作是使用以下命令在其末尾添加一個斜杠:
<action type="Redirect" url="{R:0}/" redirectType="Temporary" />
我嘗試以下網址:
http://example.com:9999/bundles/bundle.js
IIS將我重定向到http://example.com:9999/bundles/bundle.js/
但是我轉到IIS管理器,轉到IIS重寫,選擇此規則,進行測試,將URL放入,單擊測試,它說這不匹配。
如果不匹配,為什么仍要重定向?
我創建了相同的規則,它正在重定向。 因此,它無法正常工作:您的規則(^((?!\\/bundles\\/).)*[^\\/]$)
匹配 http://example.com:9999/bundles/bundle.js
您的規則中的問題。 正確的規則是(^((?!bundles\\/).)*[^\\/]$)
。 我在bundles
之前刪除了斜杠。 因為當請求進入規則時,它會將規則與路徑bundles/bundle.js
進行比較(不帶斜杠)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.