Pagination ‘This page is not working’ briefly before redirecting

I have a few templates designed to display just certain categories, for this I am using a custom query (see below) the issue I have is that the page does a Chrome (not WordPress) ‘This page is not working’ before it immediately redirects to the correct page when visiting the second page for example. Would anything in the below code cause this?

<?php
    $paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
    $args = array(
            'cat' => 5,
            'paged' => $paged,
    );

    $query = new WP_Query( $args );
    ?>

    <?php if ( $query->have_posts()):

    while ( $query->have_posts() ) : $query->the_post();

    get_template_part( 'partials/content-blog', get_post_format() );

    // End the loop.
    endwhile;

    custom_pagination($query->max_num_pages,"",$paged);

    wp_reset_postdata(); 

    endif; ?>

As a note the site is viewed through a proxy – so the htaccess is – I have wondered if this could be causing the issue:

<IfModule mod_rewrite.c>
RewriteEngine On 

RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.httpssite/blog/$1 [L,R=301]

RewriteBase /blog/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Thanks in advance for any assistance, I’m just looking to be pointed in the right direction.

Read more here: Pagination ‘This page is not working’ briefly before redirecting

Leave a Reply

Your email address will not be published. Required fields are marked *