ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Best method of implementing a custom 404 page?

September 17, 2009 6:06pm

Subscribe [3]
  • #1 / Sep 17, 2009 6:06pm

    tonyd3

    13 posts

    I have a custom 404 page template that resides in EE as 404/index.

    It’s not getting called from the other template groups save for “home”, the default template group.  But in other template groups like “about,” the 404 page never gets called it just goes to that template’s index page, which from what I gather is by design.

    So my question is this:  what is the most efficient method of directing all 404 scenarios to my 404 template group?  I tried using .htaccess to no avail, although i could have done it wrong:  ErrorDocument 404 /404


    Just to be clear this generates the correct custom 404 page:  http://www.domain.com/foo

    And this does not:  http://www.domain.com/about/foo

  • #2 / Sep 17, 2009 6:09pm

    Ingmar

    29245 posts

    Take a look at Strict URLs.

  • #3 / Sep 17, 2009 6:11pm

    design_girl

    2 posts

    I was just looking for the same info, thanks.

  • #4 / Sep 17, 2009 6:46pm

    tonyd3

    13 posts

    Thanks Ingmar!!!

    Best practice for the placement of this code in each of the template group index pages?

    {if segment_2 != ''}
      {redirect="404"}
    {/if}

    Edit:  or better yet, could this be used in an embeded header template?

  • #5 / Sep 18, 2009 12:21pm

    Ingmar

    29245 posts

    Yes, that should work. If you want to use an embed of sorts, consider Fresh variables.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases