web.config:web
<system.web>ide
<customErrors mode="On" defaultRedirect="404/index.htm">網站
<error statusCode="404" redirect="404/index.htm" />spa
</customErrors>htm
</system.web>rem
<system.webServer>it
<httpErrors errorMode="Custom" existingResponse="Auto">class
<remove statusCode="404" subStatusCode="-1" />iis
<error statusCode="404" prefixLanguageFilePath="" path="/404/index.htm" responseMode="ExecuteURL" />error
</httpErrors>
</system.webServer>
額 不知道爲何 寫了上面這個 <httpErrors> 這段,首頁也變成錯誤頁了,
沒辦法刪除了上面的這段代碼 <httpErrors>
手動在iis裏設置了下 :
打開IIS管理器-->選中維納斯網站右鍵屬性-->點擊要設置自定義404的網站的屬性-->點擊自定義錯誤選項-->選中404頁-->選中並打開消息類型-->設置成URL類型 --> URL裏填寫 /404/index.htm
-->按肯定保存退出