![](/img/trans.png)
[英]IIS 7 URL Rewrite - match a path and redirect to another in the same domain
[英]URL Rewrite IIS - Map From One Path To Another
我正在使用IIS 7中的URL重寫
我想要的行為是有人輸入時
[http:// localhost / Sales]
他們被重定向到[http:// localhost / SalesDemo]
但他們仍然在瀏覽器URL中看到[http:// localhost / Sales]
這可能嗎?
最好的方法是在URL重寫模塊中使用“ 重寫映射” 。
或者,您可以將rewrite
部分添加到web.config
文件中。
Web.config
示例:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Rewrite rule">
<match url="^Sales$" />
<action type="Rewrite" url="SalesDemo" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
請注意,如果您仍想在瀏覽器中看到/Sales
,則操作類型需要為Rewrite
(而不是Redirect
)。
我希望這會有所幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.