Skip to:
Content
Pages
Categories
Search
Top
Bottom

Pagination on homepage redirecting to root URL

  • @jwind

    Participant

    This only happens when BP is enabled and when logged in {scratches head}.

    /page/2/ (or any pagination URI) redirects -> /
    And it’s a 301 for sure. headers:

    http://lookatmybikeleaning.com/page/2/
    301: Permanent redirect to http://lookatmybikeleaning.com/
    Server IP Address: 192.185.5.15
    Server: nginx/1.6.2
    Date: Wed, 14 Jan 2015 01:20:11 GMT
    Content-Type: text/html; charset=UTF-8
    Content-Length: 0
    Connection: keep-alive
    X-Pingback: http://lookatmybikeleaning.com/xmlrpc.php
    Expires: Wed, 11 Jan 1984 05:00:00 GMT
    Cache-Control: no-cache, must-revalidate, max-age=0
    Pragma: no-cache
    Location: http://lookatmybikeleaning.com/
    Expires: Wed, 11 Jan 1984 05:00:00 GMT
    Cache-Control: no-cache, must-revalidate, max-age=0
    Pragma: no-cache
    Location: http://lookatmybikeleaning.com/

    This is the homepage.

    			if ( get_query_var('paged') ) {
    			    $paged = get_query_var('paged');
    			} else if ( get_query_var('page') ) {
    			    $paged = get_query_var('page');
    			} else {
    			    $paged = 1;
    			}
    
    		  $temp = $wp_query;
    		  $wp_query = null;
    		  $wp_query = new WP_Query();
    		  $wp_query->query('showposts=6&post_type=leaning_bikes'.'&paged='.$paged);
    
    		  while ($wp_query->have_posts()) : $wp_query->the_post();
    ...
    
Viewing 8 replies - 1 through 8 (of 8 total)
  • @jwind

    Participant

    Update: Disable the groups and everything works fine.

    @shanebp

    Moderator

    You shouldn’t call the main query and then change it and call it again.
    Besides being inefficient, it can lead to other problems.
    Try:

    $args = array(
         'post_type'      => 'leaning_bikes',
         'paged'          => $paged,
         'posts_per_page' => 6
    );
    $wp_query = new WP_Query( $args );
    
    while ($wp_query->have_posts()) : $wp_query->the_post();

    @jwind

    Participant

    No dice. Breaks the members widget as well.

    @shanebp

    Moderator

    Calling posts with pagination and using widgets on home page is pretty standard, so I suspect some issue with how your home page is built.

    btw – the home page pagination is working fine for me, using Chrome, not logged in. Maybe you just changed something?

    @jwind

    Participant

    I know it is. That’s why i’m confused. Pagination only DOES NOT work when logged in AND groups are enabled.

    Regardless of how the page is constructed there’s a 301 happening. I guess that’s what’s most puzzling.

    @shanebp

    Moderator

    Have you tried switched to a WP theme like 2012, to see if the problem persists?

    @jwind

    Participant

    Yes. Still happens. I’ve tried it locally and on live sites.

    Try to hit http://www.yoururl.com/page/2/ and it redirects to home.

    @menzer69

    Participant

    Hi jwind I did you managed to find a solution as I have the exact same issue… When I turn on Buddypress group and I sm logged in the pagination on the front page stops working however if I disable permanent links pagination works…

    Baffled

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Pagination on homepage redirecting to root URL’ is closed to new replies.
Skip to toolbar