[英]iis 6 url rewrite without isapi
我需要在不使用isapi重寫的情況下從“.... sitename.com/login.html/”配置快速IIS redriect到“.... sitename.com/login.html”。
我嘗試在Application_BeginRequest中添加重定向。
void Application_BeginRequest(object sender, EventArgs e)
{
//To Redirect Bad-Url (login.html/) which i subscribed to uConnect.intel.com
if (string.Compare(this.Request.Url.AbsolutePath, "login.html/", StringComparison.OrdinalIgnoreCase) != 0)
{
this.Response.Redirect("../login.html", true);
}
}
但它沒有被擊中,並顯示自定義404錯誤頁面。
如果我可以通過一些iis-property更改實現此目的,有人可以幫助我嗎?
最佳解決方案是使用可從中下載的Microsoft URL Rewrite
http://www.iis.net/downloads/microsoft/url-rewrite
安裝后
URL重寫選項將顯示在IIS 7.5的IIS部分下
您可以添加規則以刪除尾部斜杠
你需要配置iis6讓.net處理.html擴展名。 通常,iis只提供html頁面而不處理它們的服務器端,所以你的.net重定向代碼永遠不會被調用。
有關配置的說明,請參閱此答案: IIS 6將html作為aspx執行
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.