IIS7 Web.Config Custom Errors
- by Michael
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>