Pagination redirects to home page


Staff member
Hi I'm using pagenavi plugin, the problem is that when i click on page 2 or other pages in pagination, it redirects to my homepage, pagination is also working on home page,(a static front page). However, the wordpress pagination on archieve pages is working fine. Can anybody help me in this please...

<ul class="product-items">
$paged = (get_query_var('pages')) ? get_query_var('pages') : 1;

 $args = array(
   'posts_per_page' => 12,
   'paged' => $paged

$product_query = new WP_Query($args);

 $id = get_the_ID();


                <a href="<?php the_permalink(); ?>">
                <span class="product-img"><?php echo get_the_post_thumbnail($id, array(300,150,true)) ?></span>
                <span class="product-detail"><?php $title=get_the_title(); echo $trimed=wp_trim_words($title,3) ?></span>
            <?php endwhile;   if(function_exists('wp_pagenavi')) { wp_pagenavi( array('query' => $product_query)); }

wp_reset_postdata(); wp_reset_query()?>