开发者

How can I redirect requests to php file extensions to aspx 404

Right now I'm migrating my websites to a new server with IIS7 but I'm having a problem with 404 error pages.

Right now www.example.com/missing and www.exam开发者_JAVA百科ple.com/missing.aspx go to my 404.aspx page, but something like www.example.com/missing.php or www.example.com/missing.asdfasdf return an IIS7 404 error page.

I'd like to have my own 404 error page returned instead of the IIS7 error page, but I'm have no clue how to do it.


Configure the following to your web.config:

<configuration>
    <system.webServer>
        <httpErrors existingResponse="PassThrough">
            <remove statusCode="404" subStatusCode="-1" />
            <error statusCode="404" prefixLanguageFilePath="" 
                   path="/404.aspx" responseMode="ExecuteURL" />
        </httpErrors>
    </system.webServer>
</configuration>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜