Support » Installing WordPress » Next/Previous post goes to a 404

  • Resolved bionicdrew

    (@bionicdrew)


    I have never had these links work smoothly for me. But in this instance, they go to a ‘404 error not found’ page on page 2. I am using /%category%/%postname%/ url structure. The url it tries to go to is http://blogaddress.com/blog/page/2/ which is where the error is.
    This is the code I’m using:

    <?php get_header(); ?>
    	<div id="content" class="narrowcolumn">
    	<?php
    		$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    		query_posts("cat=3&showposts=1&paged=$paged");
    	?>
    
    	<?php if (have_posts()) : ?>
    	<div id="lefttop"></div>
    
    	<div id="blogpoint">
    	<div id="leftcol">
    		<?php while (have_posts()) : the_post(); ?>
    
    			<div id="leftsquidge">
    				<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2><br /><br />
    
    					<?php the_excerpt(); ?>
    			</div>
    			<div id="rightsquidge">
    				<?php the_tags( '<p><strong>File under:</strong> ', ', ', '</p>'); ?>
    				<?php the_time('F jS, Y') ?>  by <strong><?php the_author() ?></strong>
    			</div>
    			<div style="clear:both;"></div>
    			<br /><br />
    		<?php endwhile; ?>
    		<div class="navigation"	style="padding:0px;margin:0px;">
    			<div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
    			<div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
    		</div>
    	<?php endif; ?>
    		<div style="clear:both;"></div>
    		</div>
    
    		</div>
    		<div id="leftbot"></div>
    	</div>
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    I had a search around and i cannot find anyone else who has had this problem. Does anyone know what I am doing wrong?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Your basic query and pagination code works for me. Try resetting your permalinks and make sure the change saves.

    Its a lot easier to help if you can provide a real URL.

    Thread Starter bionicdrew

    (@bionicdrew)

    I had to set up a Page template for it. I had tried it previously but it didn’t work. After another try it worked. Fickle, fickle wordpress

    Say, BionicDrew, I have the same problem and have found many others with variations of it but with answers that 1) I don’t understand, or 2) don’t work. I haven’t found a single one of my categories that works properly.

    For example:
    http://www.everydaychristianity.com/guitar-tips/
    When I scroll to the bottom and click on “Next Page >>” I get a 404 error (I’ve changed it to read “End of Articles” but it’s not!)
    The URL shown is:
    http://www.everydaychristianity.com/guitar-tips/page/2/

    My custom permalink structure is:
    /%category%/%postname%/

    Would your solution of a Page template work for me? If, so could you provide a few specifics?

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Next/Previous post goes to a 404’ is closed to new replies.