Merhaba arkadaşlar malum iis7 ile birlikte gelen url rewrite popularitesine uyarak linklerimizi artık bu şekilde düzenliyoruz.Url rewrite ile ilgili olarak bir konuda takıldım ve aramalarım sonucunda birşey bulamadım.

Şimdi örnek olarak siteadi.com/images/abc.jpg diye bir resim yolu var.Eğer burda abc.jpg isimli bir resim yoksa 404 hata sayfası yerine ben bunu siteadi.com/images/bulunamadi.jpg linkine nasıl yönlendirebilirim.

Sorunu çözdüm aynı sorunla karşılaşan olursa:
web.config dosyasına alttakileri ekliyerek 404.asp sayfasına yönlendirme yapılıyor

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
    <httpErrors errorMode="Custom" existingResponse="Auto">
        <remove statusCode="404" subStatusCode="-1" />
        <remove statusCode="403" subStatusCode="-1" />
        <remove statusCode="401" subStatusCode="-1" />
        <remove statusCode="405" subStatusCode="-1" />
        <remove statusCode="406" subStatusCode="-1" />
        <remove statusCode="412" subStatusCode="-1" />
        <remove statusCode="500" subStatusCode="-1" />
        <remove statusCode="501" subStatusCode="-1" />
        <remove statusCode="502" subStatusCode="-1" />
        <remove statusCode="503" subStatusCode="-1" />
        <error statusCode="403" prefixLanguageFilePath="" path="/404.asp" responseMode="ExecuteURL" />
        <error statusCode="404" prefixLanguageFilePath="" path="/404.asp" responseMode="ExecuteURL" />
        <error statusCode="405" prefixLanguageFilePath="" path="/404.asp" responseMode="ExecuteURL" />
        <error statusCode="406" prefixLanguageFilePath="" path="/404.asp" responseMode="ExecuteURL" />
        <error statusCode="412" prefixLanguageFilePath="" path="/404.asp" responseMode="ExecuteURL" />
        <error statusCode="500" prefixLanguageFilePath="" path="/404.asp" responseMode="ExecuteURL" />
        <error statusCode="501" prefixLanguageFilePath="" path="/404.asp" responseMode="ExecuteURL" />
        <error statusCode="502" prefixLanguageFilePath="" path="/404.asp" responseMode="ExecuteURL" />
        <error statusCode="503" prefixLanguageFilePath="" path="/404.asp" responseMode="ExecuteURL" />
    </httpErrors> 
</system.webServer>
</configuration>