EE: Custom 404 page

  • Started
  • Last post
  • 2 Responses
  • keiTai

    Quick Expression Engine question: How to redirect to a custom page if a page/weblog entry doesn't exist?

    Been playing with EE this weekend, i am trying to create pages from weblog entries. (using core)
    The problem is when i point the browser to mydomain.com/blogname/tmpl/QBN i get all the weblog entries and not a 404 page.

    Any advice, tips?

  • version30

    edit your .htaccess file
    add this to the next line
    ErrorDocument 404 /404page.html

    replace the "/404page,html" with whatever the url you have designated as your 404 page and viola

    • tx i don't even get a 404 warning.
      Hadn't turned it on in EE
      keiTai
  • keiTai0

    tx, version3 but i found a solution

    in EE
    1/ created a 404 template
    2/
    {if segment_2 != ''}
    {redirect="404"}
    {/if}
    in my EE template's at top
    3/ enabled custom 404 in EE template preferences

    • hmm, not working correctlykeiTai
    • Due to the dynamic nature of EE's URL structure, there is no guarantee about exactly what any particular URL segment represents beyond the first segment. Thus, the error can only be triggered by a Template Group name that doesn't exist.keiTai
    • represents beyond the first segment. Thus, the error can only be triggered by a Template Group name that doesn't exist.keiTai
    • that doesn't exist.keiTai