Title: Archive navigation problem
Last modified: August 20, 2016

---

# Archive navigation problem

 *  [Gonçalo Peres](https://wordpress.org/support/users/gonperesgmailcom/)
 * (@gonperesgmailcom)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/archive-navigation-problem/)
 * Greetings Chouby
 * Regarding the problem navigating to a URL like “/category/name/page/2” being 
   redirected back to “/category/name/”, I just tried development version 0.9.5.4
   and it fixes that problem.
 * However “/category/name/page/1” is still NOT redirecting to “/category/name”.
   And it’s not good to have two different URLs for the same page.
 * [http://wordpress.org/extend/plugins/polylang/](http://wordpress.org/extend/plugins/polylang/)

Viewing 9 replies - 1 through 9 (of 9 total)

 *  Plugin Author [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/archive-navigation-problem/#post-3213430)
 * Hello Gonçalo Peres,
 * Yes, 0.9.5.4 was a very quick fix for this pagination issue introduced in 0.9.5.
   In fact, I just removed a function, which was added to solve this issue: [http://wordpress.org/support/topic/same-post-in-different-urls](http://wordpress.org/support/topic/same-post-in-different-urls)
 * Now I have reworked it and hopefully I did not introduced a new bug.
 * The problem with “/category/name/page/1” is a different one and should be solved
   in the current development version too (0.9.5.5)
    [http://downloads.wordpress.org/plugin/polylang.zip](http://downloads.wordpress.org/plugin/polylang.zip)
 *  Thread Starter [Gonçalo Peres](https://wordpress.org/support/users/gonperesgmailcom/)
 * (@gonperesgmailcom)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/archive-navigation-problem/#post-3213435)
 * Hello Chouby.
 * The problem with “/category/name/page/1” is still present on Polylang 0.9.5.5
 * Test case:
    [http://www.voiceoverportugal.com/pt/cat/video](http://www.voiceoverportugal.com/pt/cat/video)
   [http://www.voiceoverportugal.com/pt/cat/video/page/1](http://www.voiceoverportugal.com/pt/cat/video/page/1)
 * The second URL is not redirect to first one.
    WordPress Multisite 3.4.2 / Polylang
   0.9.5.5
 * Thank you and keep it up 🙂
 *  Plugin Author [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/archive-navigation-problem/#post-3213437)
 * Are you using a plugin for pagination? I have no more issue with the standard
   WordPress pagination functions. In your case, the link is generated with ‘/category/
   name/page/1’ and Polylang does not generate such link. Basically it just adds
   the language code to an already created link.
 *  Thread Starter [Gonçalo Peres](https://wordpress.org/support/users/gonperesgmailcom/)
 * (@gonperesgmailcom)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/archive-navigation-problem/#post-3213438)
 * No navigation plugins, just the good old default “paginate_links()” function 
   in my archive.php template:
    [http://codex.wordpress.org/Function_Reference/paginate_links](http://codex.wordpress.org/Function_Reference/paginate_links)
 * This function generates those nice “prev,1,2,3,…next” buttons to navigate archive
   pages. When you go to “/category/name/page/2”, the link to the first page becomes“/
   category/name/page/1”. WordPress detects this and automatically redirects to “/
   category/name” (301 permanent)
 * I believe Polylang somehow avoids this redirection. Could it be the case?
 * We can avoid the “page/1” url with this simple trick:
 *     ```
       $big = 999999999;
       $nav_pages = paginate_links( array(
           'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
           'format' => '/page/%#%',
           'current' => max( 1, get_query_var('paged') ),
           'total' => $wp_query->max_num_pages,
           'prev_text' => '&laquo;',
           'next_text' => '&raquo;',
           ) );
       $nav_pages = str_replace('/page/1', '', $nav_pages);
       echo $nav_pages;
       ```
   
 * But it will still exist 2 URLs for the same page, which WordPress by default 
   solves.
    Try it: [http://www.hipersuper.pt/category/producao/page/1/](http://www.hipersuper.pt/category/producao/page/1/)
   This site doesn’t have Polylang and so the redirection takes place.
 * Thank you for looking into it.
 *  Plugin Author [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/archive-navigation-problem/#post-3213439)
 * I did not know this function. Thanks for this!
 * I included your code in Twenty Ten for test purpose. The link is correctly generated(
   without /page/1) thanks to your str_replace. The link /category/name/page/1 is
   correctly redirected to /category/name by WordPress.
 * Test done with WordPress 3.4.2 and Polylang 0.9.6
 * Yes in Polylang 0.9.5, there is a bug which prevents the WordPress canonical 
   redirection to work correctly in some cases. This should be solved since 0.9.5.5
 *  Thread Starter [Gonçalo Peres](https://wordpress.org/support/users/gonperesgmailcom/)
 * (@gonperesgmailcom)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/archive-navigation-problem/#post-3213442)
 * Hello Chouby.
 * My “str_replace” fix doesn’t make any redirection, it only avoids the “page/1”
   link to be created. But all those who use these function in “archive.php” or “
   index.php” templates, will get the “page/1” link, unless they implement this 
   simple workaround.
 * Slight improvement 😉
 * `if(get_query_var('paged') > 1) $nav_pages = str_replace('/page/1', '', $nav_pages);`
 * By the way, paginate_links() function has no hooks to make it other way…
 * Anyway, are you planning on looking how to make “/pt/category/name/page/1” links
   redirect to “/pt/category/name”, without this workaround?
 * It’s not such a big deal, but let me know if you can work on that. Maybe in the
   process you can find more WordPress automatic redirections that you missed.
 * Thank you Chouby 🙂
 *  Plugin Author [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/archive-navigation-problem/#post-3213454)
 * Now it should work. At least it does on my test site. If I remove the str_replace,
   the link is generated with ‘/page/1’ which is correctly redirected by WordPress
   without any interference from Polylang.
 * If it still does not work with Polylang 0.9.6 then I will need more information
   to try to reproduce the bug: Permalinks settings, Polylang settings and if you
   are using a static front page or not.
 *  Thread Starter [Gonçalo Peres](https://wordpress.org/support/users/gonperesgmailcom/)
 * (@gonperesgmailcom)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/archive-navigation-problem/#post-3213455)
 * Still not working with Polylang 0.9.6.
    Test: [http://saraperes.com/pt/blog/trabalhos-recentes/page/1](http://saraperes.com/pt/blog/trabalhos-recentes/page/1)
 * Permalink structure: “/%year%/%postname%”
 * Category base: “blog”
 * Yes I’m using a static front page.
 * Polylang Settings:
    – [checked] When the front page is visited, set the language
   according to the browser preference – [checked] The language code, for example/
   en/, is added to all urls when using pretty permalinks. – [checked] Remove /language/
   in pretty permalinks. Example: [http://saraperes.com/en/](http://saraperes.com/en/)–[**
   un**checked] Hide URL language information for default language – [checked] When
   using static front page, redirect the language page (example: [http://saraperes.com/en/](http://saraperes.com/en/))
   to the front page in the right language – [**un**checked] Allow to synchronize
   categories, tags, featured image and other metas between translations of a post
   or page **_(What is this option for, by the way?)_**
 * Hope you can fix it with not too much trouble 🙂
 * Thank you!
 *  Plugin Author [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/archive-navigation-problem/#post-3213457)
 * I reproduced the bug with your settings. Hopefully, this time I fixed it in the
   development version 0.9.6.3.
    [http://downloads.wordpress.org/plugin/polylang.zip](http://downloads.wordpress.org/plugin/polylang.zip)
 * The synchronization option allows you (for example) to have exactly the same 
   tags (translated) in posts translations. If you add/remove one in a post, it 
   automatically add/remove it in the translations.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Archive navigation problem’ is closed to new replies.

 * ![](https://ps.w.org/polylang/assets/icon-256x256.png?rev=3433336)
 * [Polylang](https://wordpress.org/plugins/polylang/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/polylang/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/polylang/)
 * [Active Topics](https://wordpress.org/support/plugin/polylang/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/polylang/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/polylang/reviews/)

 * 9 replies
 * 2 participants
 * Last reply from: [Chouby](https://wordpress.org/support/users/chouby/)
 * Last activity: [13 years, 6 months ago](https://wordpress.org/support/topic/archive-navigation-problem/#post-3213457)
 * Status: not resolved