5

I am a little shaky on how a 404 that returns the proper information should be setup. Right now, I have a 404 template that I note in my .htaccess as my 404 page. I was considering switching this to a page in EE's Pages module. Is this compatible with a proper 404 setup?

9

Your biggest point of attention should be the response header for your URL. EE will take care of setting it as a 404 response provided you have selected the template in use in the Global Template Preferences seen below. (Docs reference)

enter image description here

I'd recommend using a template rather than an entry + pages module. It's just simpler that way.

1
  • 1
    +1. Then in your template you can hard-code a reference to an entry managed by the Pages Module to make the content of the 404 page editable like any other "page" on your site.
    – Alex Kendrick
    Dec 5 '12 at 19:20
3

You don't need to use the Pages module, but you can use a channel entry to make the 404 page more dynamic, it just needs a dedicated template in order for the ExpressionEngine 404 handling to work correctly.

Often I'll simply duplicate my standard page template to be my 404 template and just hard code the entry in, instead of dynamically loading it from the URL.

1
  • 1
    Also of note, Erik is correct above. Ensuring that the 404 response is provided is key and using EE's built in 404 settings will do that for you. Dec 5 '12 at 19:21
3

You might find Guide to 404 Pages with ExpressionEngine useful:

http://joviawebstudio.com/index_ee.php/blog/guide_to_404_pages_with_expressionengine/

1
  • Thanks, very good link! I like the requires_entry option, works perfectly on my templates.
    – Lea Hayes
    Dec 5 '12 at 23:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.