IIS7 Web.Config Custom Errors
Posted
by Michael
on Stack Overflow
See other posts from Stack Overflow
or by Michael
Published on 2010-04-19T03:14:08Z
Indexed on
2010/04/19
3:23 UTC
Read the original article
Hit count: 525
Using GoDaddy to host my site (I know that's my first problem)! :-)
Trying to setup customer error messages for my site. GoDaddy allows you to setup a 404 in their control panel, but I can't override this, or setup any additional error redirects, specifically a 500-server error.
Here is my web.config file:
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect to WWW" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^mysite.com$" />
</conditions>
<action type="Redirect" url="http://www.mysite.com/{R:0}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
<system.web>
<customErrors mode="On" defaultRedirect="http://www.mysite.com/oops.php">
<error statusCode="404" redirect="http://www.mysite.com/oops.php?error=404" />
<error statusCode="500" redirect="http://www.mysite.com/oops.php?error=500" />
</customErrors>
</system.web>
</configuration>
© Stack Overflow or respective owner