3

I have to set strict urls to no, because I am using a dynamic segment_1 with category_urls. So I have to use the default 404 error template. The 404 errors work but the pages return a 503 header and not a 404 header.

I tried inlcuding a custom 404.php instead of the

$this->log_item("404 Page Returned");
$this->EE->output->set_status_header(404);
echo '<html><head><title>404 Page Not Found</title></head><body><h1>Status: 404 Page Not Found</h1></body></html>';

But it’s still a 503. Am I missing a setting? What can I do to make it actually 404? I am on EE 2.5.5

Thanks Philip

3
  • Can't you just use {redirect="404"} in your main index template to display the custom 404 page when necessary? (even with strict URLs disabled) Commented Mar 11, 2013 at 15:29
  • Basically yes. Meaning I turn strict urls off, but activate the 404 EE template. But it is not working on all pages. It seems to work on categories and pages but not on single entries. Single entries are just a broken site then. When I turn both strict urls and 404 EE template off the 404 pages are always correct. Also triggered by {redirect="404"}. However the default 404 page which I am getting then has a 503 header instead of a 404.
    – Philip
    Commented Mar 11, 2013 at 15:46
  • I just made some tests. With strict urls turned on/off, template turned on/off and my always have a 503 header. Maybe EE is doing the 404 handling right and my problem is somwhereelse?
    – Philip
    Commented Mar 11, 2013 at 15:54

1 Answer 1

2

Try setting the 404 status using HTTP Header plugin.

Put following tag in your 404 template: {exp:http_header status="404"}

4
  • Hi Yuri, Thanks for your suggestion. But with strict url set to no I cannot use a EE template as 404 site. That's why I have to use the default 404 template in /libraries/Template.php.
    – Philip
    Commented Mar 10, 2013 at 14:29
  • 1
    You can, actually. There's good reading on this: Guide to 404 Pages with ExpressionEngine by Ryan Battles Commented Mar 10, 2013 at 14:48
  • Yes, thanks. But he is using strict urls set to YES. I have NO.And his outside of EE solution is not working for me because it is returning a 503 for me. Not a 404. That's my acutal problem.
    – Philip
    Commented Mar 10, 2013 at 18:55
  • I tried the HTTP Header plugin. But with {exp:http_header status="404"} I am still getting a 503 Error. When I use the location paramater, my site is actually redirected.
    – Philip
    Commented Mar 12, 2013 at 8:21

Your Answer

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

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