Welcome to MSDN Blogs Sign in | Join | Help

News

  • These postings are provided "AS IS" with no warranties, and confer no rights. Use of included code samples are subject to the terms specified Terms of Use
Tip #93: Did you know … PHP and Custom Error Pages configuration?

When deploying PHP web applications that handle their errors with their own error pages, the existingResponse for Custom Error Pages feature of IIS should be set to “PassThrough” for that particular site. This greatly improves the customer experience when accessing your new application, particularly if your custom error pages are merely the defaults that come with IIS.

Custom Error Pages set to “Auto” (the default):

scratch1

Custom Error Pages set to “PassThrough”:

scratch2

This property can be set for either the site in particular or the server as a whole. To set it for the server, using appcmd.exe (found in %windir%\system32\inetsrv), the command is

appcmd.exe set config -section:system.webServer/httpErrors /existingResponse:"PassThrough" /commit:apphost

However, you can also do this on a per site, application, or virtual directory basis as well. Using appcmd, use the following command:

appcmd.exe set config "Default Web Site/application" -section:system.webServer/httpErrors /existingResponse:"PassThrough"

Replace “Default Web Site/application” with the actual path to your desired location to change.

You can also do this by editing (and creating if needed) a web.config file in the actual folder of the location, which would look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <httpErrors existingResponse="PassThrough" />
    </system.webServer>
</configuration>

And voila, you’re done!

 

Kern Handa | SDET | IIS Team

Posted: Monday, August 24, 2009 8:11 AM by WebDevTools

Comments

Olivier Garbé said:

Hello,

the problem I see is with the 500 error (max execution time for example) which won't be a friendly page.

Do you know how to disable IIS custom error for 404 and enable it for 500 ?

# October 21, 2009 3:10 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker