How to add a custom "404 Page Not found" html page

Discussion in 'Site Programming, Development and Design' started by Alex Kintner, Oct 27, 2014.

  1. Hi All,
    I have a branch of my site that is just plain html (not under a Virtual Directory).
    Is there a way to cause a custom 404Error.html page to load when a user tries to access an invalid page? or browse a folder?

    The default 404 page is not good because it exposes the site Physical Path -- the hackers will love it.
     
  2. Elshadriel

    Elshadriel Winhost Staff

    Here are some instructions on how to enable custom errors.

    1) Log into your site using IIS7 Manager by following the instructions in this Knowledge Base article.
    2) Double click on the Error Pages module to open it.
    3) On the right hand side, click on the Edit Feature Settings... link.
    4) Check Custom error pages, put in the Default Page Path, select File as your Path type and click on OK.

    Alternatively, you can also enable custom errors by manually editing the web.config file.

    For IIS6, ASP, and Classic mode applications, please update this line in the web.config file:

    <customErrors defaultRedirect="url" mode="On" />

    For IIS7, ASP.NET, and Integrated mode applications, please update this line in the web.config file:

    <httpErrors defaultPath="url" errorMode="Custom" />

    Make sure you replace url with the URL to your error page.
     
    Last edited by a moderator: Oct 14, 2015
    Michael and Alex Kintner like this.
  3. Thanks Elshadriel. I didn't know I could manage my Winhost site from client IIS Mgr. Perfect.
     
    Michael and Elshadriel like this.

Share This Page