[英]IIS Url rewrite username
如何在IIS中重寫此URL
mysite.com/profile.aspx?user=foo
至
mysite.com/foo
我在.htaccess中嘗試過的重寫條件
RewriteRule /foo/(.*) /bar?arg=P1\%3d$1 [R,NE]
但是,如何在IIS網址重寫中做到這一點?
很簡單:
<rule name="Profile Rewrite" stopProcessing="true">
<match url="^([^/]+)/?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="isFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="isDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="profile.aspx?user={R:1}" />
</rule>
請注意,您的Apache重寫規則實際上將根本無法達到您的期望。 還要注意,您可以從IIS管理器中的URL重寫可視化配置工具輕松生成此文件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.