WordPress.org

Ready to get started?Download WordPress

Forums

Cannot get any 404 redirection to work (5 posts)

  1. rpieket
    Member
    Posted 2 years ago #

    I've tried several 404 redirection plug-ins, but none of them work. I tried the "404 Redirected", "404 Redirection", "No 404 Errors", and "Smart 404" plug-ins -- only one at the time, of course. The result is always the same:

    The requested URL /foo.html was not found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

    What could be going on?

    My website is ItShouldJustWorkTM.com hosted on bluehost.

    -Ron.

  2. rpieket
    Member
    Posted 2 years ago #

    I got great support from blue host, and they determined that the problem was caused by a blank .htaccess file. I'm not sure what this is, and according to the info I could find about that file, you only need it if you are using pretty permalinks, which I'm not.

    In any case, they placed the following .htaccess, and at least it's now jumping to the front page on any 404 error. However I still am unable to use any of the 404 plug-ins. The 404 page now always goes to the front page, regardless of settings in the plug-in.

    -Ron.

    # BEGIN WordPress

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

  3. bh_WP_fan
    Member
    Posted 2 years ago #

    What theme are you using? Many themes define their own 404 page. It is usually named something like 404.php. You can try creating your own 404 page manually and then replacing any appearances of your theme's 404 page with your own. You can also try a different theme and see if it makes a difference.

  4. rpieket
    Member
    Posted 2 years ago #

    I'm using the Yoko theme. I tried switching themes but the result is always the same. I have pasted 404.template from the Yoko theme below. But I never get to see Yoko's 404 page, all 404's directly jump to the home page. I have disabled all 404 related plug-ins.

    The current behavior (404 jumps automatically to home page) is not bad. But it would be nice to get control over it again.

    I did establish that my .htaccess was destroyed by activating the "404 Redirected" plug-in. This plug-in replaces .htaccess with a blank file and does not restore it when deactivated.

    This is the Yoko theme's 404 template (which I never see so I don't think it is the problem):

    <?php
    /**
     * @package WordPress
     * @subpackage Yoko
     */
    
    get_header(); ?>
    
    <div id="wrap">
    <div id="main">
    
    	<div id="content">
    		<article id="page">
    			<header class="page-entry-header">
    				<h1 class="entry-title"><?php _e( 'Not Found', 'yoko' ); ?></h1>
    			</header><!-- end page-entry-header -->
    
    			<div class="single-entry-content">
    				<p><?php _e( 'Apologies, but the page you requested could not be found. Perhaps searching will help.', 'yoko' ); ?></p>
    				<?php get_search_form(); ?>
    			</div>
    
    			<script type="text/javascript">
    				// focus on search field after it has loaded
    				document.getElementById('s') && document.getElementById('s').focus();
    			</script>
    		</article>
    	</div><!-- end content -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
  5. bh_WP_fan
    Member
    Posted 2 years ago #

    Place a file named 404.php with your custom code in wp-content/yourthemehere and see if that works. If it doesn't, try a different theme and try doing the same thing. If your theme already has a 404.php file there, be sure to back it up first.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags