Support » Fixing WordPress » ErrorDocument problem

  • The 404 error page is not displayed out of the theme folder after changing to crust-free permalinks using mod-rewrite and putting in a .htaccess file with the snippet shown on the admin page.

    I have a 404.php in my active theme folder, but it is not being called in 404 situations.

    Pl help me

    Regards
    S.K
    http://blog.cyberbrahma.com/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Moderator James Huff

    (@macmanx)

    Volunteer Moderator 🚀

    You need to add a line to .htaccess for this. Create the following line (using the correct path to your 404.php file) and add it to the .htaccess file in your site’s root directory:

    ErrorDocument 404 /wp-content/themes/default/404.php

    Thanks, macmanx.

    But why not the error page be called, like it does in the case of /index.php?error=404 is my question!

    When the query string is changed for other files, I think this 404.php also should be called likewise, as otherwise the paths to include files becomes a problem.

    Hope I have stated my problem properly.

    Thanks and regards
    S.K
    http://blog/cyberbrahma.com/

    ErrorDocument 404 /index.php?error=404

    With that, if a mod_rewrite rule is not matched, Apache tells WP to load the 404 page for the active theme. The ErrorDocument line is not added to .htaccess by default.

    If a mod_rewrite rule matches but the resultant query does not match any posts, WP loads the 404 template. If you use PATH_INFO permalinks and if either an internal rewrite rule doesn’t match or a query doesn’t resolve to any posts, WP loads the 404 template.

    There are several 404 scenarios, ErrorDocument in .htaccess only handles the case where no mod_rewrite rules are matched.

    Correction :
    My blog URL:-
    http://blog.cyberbrahma.com/

    Thanks rboren.

    <quote>If you use PATH_INFO permalinks and if either an internal rewrite rule doesn’t match or a query doesn’t resolve to any posts, WP loads the 404 template.</quote>

    But I use PATH_INFO permalinks. And I expect the 404 template from the active theme folder to be loaded (when 404 situation occurs), but it doesn’t take place.

    Now, in dummy’s terms, if PATH_INFO permaliks are opted, the default 404 template will not be loaded unless its path is defined in the errorDocument statement of the .htaccess file.

    Am I right in my postulate?

    Regards
    S.K

    Moderator James Huff

    (@macmanx)

    Volunteer Moderator 🚀

    No, actually I quoted the wrong ErrorDocument rule. Sorry for the confusion. If permalinks are active, the .htaccess line should still be:

    ErrorDocument 404 /wordpress/index.php?error=404

    ok,
    there has to be a simple thing I am missing.
    in .htaccess I have:
    ErrorDocument 404 /wp-content/themes/default/404.php

    the error I continur to get is:

    Fatal error: Call to undefined function: get_header() in ../../../../../../……default/404.php on line 1

    Help?

    Thanks!
    T

    Ok,

    several attempts have resulted in success.
    .htacces required this:

    ErrorDocument 404 /index.php?error=404

    Now – no errors in the 404.php document!
    Yeah!

    How many hours can it take to work something so simple out?
    Well, it was fun anyway 🙂

    Hi guys, i tried the ErrorDocument 404 /index.php?error=404 solution, but what happens is if i have a link that goes like http://myhost.com/chicken – it’ll show up a 404 page. but if i have a link that goes http://mohost.com/chicken.php – it says “No input file specified.” and not the 404 page.

    if i didn’t have the ErrorDocument line, the server won’t redirect to the WP’s 404 page in my theme but the generic 404 error message.

    any suggestions?

    thanks.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘ErrorDocument problem’ is closed to new replies.