« Previous Next »

Thread: Question on custom 404 error pages

Last post 11-05-2009 1:23 PM by derekburke72. 7 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (8 items)

Sort Posts:

  • 09-25-2009, 10:37 PM

    Question on custom 404 error pages

    HI Everyone,

        I'm not sure how to do this and I hope someone can tell me. I'm running IIS6 and what I have is a custom 404 error page that displays correctly if someone types in a bad url ex: www.companyname.com is good and someone types in www.companyname.com/jajsakl23

    What I'm looking to do is to have the same custom 404 error page appear for all my sub sites. So if someone types in www.companyname.com/services it brings them to the services page but if they type www.companyname.com/services/232jksadlfj I just get a bogus text version of the services page. I'd like that type of URL to be redirected to my custom 404.

    Thanks

  • 09-26-2009, 11:19 PM In reply to

    Re: Question on custom 404 error pages

    This posting has a link to how to setup custom errors

    http://forums.iis.net/t/1157187.aspx

    Steve Schofield
    Windows Server MVP - IIS
    http://weblogs.asp.net/steveschofield


    http://www.IISLogs.com
    Log archival solution
    Install, Configure, Forget
  • 09-28-2009, 9:06 AM In reply to

    Re: Question on custom 404 error pages

    Hi Steve,

       Thanks for the reply. I've actually setup the page and it works on my root directory, like I said earlier www.%compnayname%.com/2342342 works fine, the cutom error is displayed correctly, there is no 2342342 directory. There is a contact-us sub directory/sub site where the custom error does not display correctly. So if someone types www.%companyname%.com/contact-us/erwerw332 they do not see the customer error. In IIS I have the 404 from the root site as the custom error page but it's not displaying.

    Any thoughts?

    Thanks

  • 10-01-2009, 3:53 AM In reply to

    Re: Question on custom 404 error pages

    Hi,

    Could you please check if the sub directories have the same custom error settings as the root directory's ?

    Leo Tang
    Microsoft Online Community Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • 10-01-2009, 9:14 AM In reply to

    Re: Question on custom 404 error pages

    Yes they do, each sub-page has the custom 404 error listed as the default file to use.

     

  • 10-01-2009, 10:55 PM In reply to

    Re: Question on custom 404 error pages

    Hi,

    Which message type you used for the custom error ? If you selected URL, the custom error URL must exist in the application pool that directs the request to the custom error URL.

    If your sub application is an ASP.NET application, you need to set the custom error in Web.config file(Click the ASP.NET tab->Click Edit Configuration->Navigate to Custom errors ).

    Leo Tang
    Microsoft Online Community Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • 10-02-2009, 9:22 AM In reply to

    Re: Question on custom 404 error pages

    Thanks for the reply to this. I'm sorry but I'm very new to IIS management. I don't think that the page is an asp.net page as there is no web.config file in the directory structure of the site.

     From IIS manager if I right click on my comanpy's site and select properties/Custom Errors I find the custom 404 html file listed as the 404 error. This is the same on all the sub directories in IIS for my site. The only site it's working for is the root. I hope that helps and answers some of your questions.

    Thank you so much for your time.

  • 11-05-2009, 1:23 PM In reply to

    Re: Question on custom 404 error pages

     Hi Everyone.

        Thank you for your assistance. I figured the problem out. In the 404 page it's self I found that all the graphic files and the styles.css file were just listed with an absolute path, ex: /styles/styles.css. Looking at another companies 404 error page I found that they put a ../ at the start of the path. This resets the path to the file to the root of the directory. So when someone typed www.siteA.com/23423 which is a bad address the 404 page would look for the styles.css file in the siteroot/23423/styles/styles.css which doesn't exist. By putting the ../styles/styles.css this resets the path to the root which was siteroot/styles/styles.css which is correct. Once I made this change the site looked much better and then it was a simple matter of finding all the graphic files that were referenced in the 404 page and adding the ../ to the front of the path. 

     

    Thanks again!

Page 1 of 1 (8 items)
Microsoft Communities