Support » Plugins » Make error pages point outside the theme

  • You’ve probably invented this wheel already, but I haven’t found it yet.

    Using multiple themes can you make the Error pages point to a constant place (within Word Press) rather than to a 404.php in a particular theme? I’m thinking something along the lines of the file being in /wp-content/
    I’m not at all sure about the editing I did here to include the header, sidebar and footer
    <?php include (TEMPLATEPATH . get_header() ); ?>

    <h2><?php _e(‘Not Found’); ?></h2>

    <?php _e(‘Sorry, but the page you requested cannot be found.’); ?>

    <h3><?php _e(‘Search’); ?></h3>

    <?php include (TEMPLATEPATH . ‘/searchform.php’); ?>

    <?php include (TEMPLATEPATH . get_sidebar() ); ?>

    <?php include (TEMPLATEPATH .get_footer(); )?>

    Then using .htaccess to point the error page to FULL_URL/WORD PRESS LOCATION/index?404.php or would FULL_PATH/404.php work as well and cover any other directories if it is in the root folder?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Make sure your .htaccess has this line:

    ErrorDocument 404 /index.php?error=404

    It will automatically select the 404 file from your theme, so you don’t need to point to the full path.

    Of course put the path to index.php if wordpress is not installed on the root of your domain.

    Hope this answers your question.

    Ajax is correct, set your ErrorDocument as needed.

    Secondly though, there’s no need to do an include for all of rhtose files. You can simply do get_sidebar(); or get_footer(); if you have a sidebar.php and/or a footer.php. It saves from having to do so many include calls.

    Thread Starter asparagus

    (@asparagus)

    OK, I’m not clear about those answers. Maybe my question wasn’t clear.

    ROOT (containing regular .html files and folders and a .htaccess file)

    ROOT/WPblog/(guts of WP and contnts in a quasi-standard arrangement with the .htaccess that sets permalinks)

    Question 1. With multiple Themes can one 404.php work across all them? Does it need to set up and referred to outside the Theme’s normal location?
    From the two answers above, it seems the default theme that admin selects would overide the Theme the viewer might choose to be using. Or am I reading too much into this.

    Question 2. If I set the ErrorDocument in the .htaccess file in ROOT/WPblog/ it covers only errors in that section. Will changing it in ROOT’s .htaccess make it work throughout the whole site as well? And in that case is the full path required?
    I’m guessing from the answers it is a yes to both.

    Thanks for the responses, sorry for the poorly expressed question. Or maybe I’m just dense this lifetime.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Make error pages point outside the theme’ is closed to new replies.