2

We have created http://www.macobserver.com/tmo/404_not_found — That page works.

I then added

ErrorDocument 404 /tmo/404_not_found

to our apache config. Without that line in there Apache delivers its default 404, so I know that logic works. With that line in there, though, I get our home page, NOT the 404 template. It comes in with a 404 header properly, but it doesn't display the right template.

Any ideas why? I've been beating my head on this one before posting here (as we all do, I'm sure :)

(and yes, we renamed our index.php to tmo years ago with EE 1.x)

2
  • 1
    Normally 404s with EE are handled by the CMS itself, not the Apache config. Since the pages/entries don't exist as files, Apache has no idea what is and isn't found. EE allows you to place a {redirect="404"} tag into templates when entries are not found in order to trigger the 404 page that's configured in the global template preferences. Mar 13, 2014 at 16:50
  • Thanks, Jeremy. This was happening with 404's outside of EE. If someone loaded site.com/nonexistent/path/file.html I wanted them to get the EE 404 page... and it wouldn't work — all the above line would do is return the main home page. Bizarre. Especially because without that line in .htaccess Apache would deliver its default 404, so we know the logic was working up and until EE tried to do ... something. Mar 19, 2014 at 17:21

2 Answers 2

1

First, make sure you have enabled "Strict URLs" and chosen you 404 template in in the control panel.

Control Panel Location: Design > Templates > Template Preferences

enter image description here

Take a look at Global Template Preferences in the ExpressionEngine User Guide for more information.

1
  • Thanks, that may be it. We enabled that a while back and it broke some stuff we were doing. But that may have been in a previous version. Mar 19, 2014 at 16:48
0

you just need to add index.php

try:

ErrorDocument 404 /index.php/tmo/404_not_found

OR:

ErrorDocument 404 /index.php?/tmo/404_not_found

Regard's.

2
  • What do you mean? What you wrote here is exactly what I typed above. I'm curious... I think you might be on to something here. ;) Mar 19, 2014 at 16:48
  • sorry I forget to add the index.php
    – Ahmad Saad
    Mar 19, 2014 at 19:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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