WordPress.org

Forums

Custom Permalink and Previous/Next links (5 posts)

  1. TheNut
    Member
    Posted 8 years ago #

    Hello all,
    I did some search here but couldn't find an answer to this problem.
    I am referring to the Previous/Next links on the category page. They work great when you are using the default Permalink but if you wish to switch to the custom one, this links (Previous/Next links) will get you to an error page.

    <?php posts_nav_link('','','Previous News »') ?>

    <?php posts_nav_link('','« Newer News ','') ?>

    Is there a way to solve that?

    Thanks

  2. solutionsphp
    Member
    Posted 7 years ago #

    I'm having a similar problem using WP 2.0.11 and permalinks.

    My permalink structure is:

    /%category%/%postname%/

    On my archive pages, the next/prev links look like:
    http://www.mydomain.com/category-name/page/2/

    That link should be:
    http://www.mydomain.com/category/category-name/page/2/

    If I manually type in and visit the URL:
    http://www.mydomain.com/category/category-name/page/2/

    then "category" is appended as it should be in the next/prev links that appear on this page.

    When I turn off permalinks, the problem goes away:
    http://www.mydomain.com/index.php?cat=1

    Any ideas?

  3. solutionsphp
    Member
    Posted 7 years ago #

    I also want to add that this problem exists with both my custom theme AND the default theme.

    Any ideas, this is driving me bonkers?!

  4. moshu
    Member
    Posted 7 years ago #

    On some servers including the %category% in the permalinks can cause troubles.
    Could you try removing it and/or trying another permalink structure?

  5. solutionsphp
    Member
    Posted 7 years ago #

    Thanks moshu! I replaced

    /%category%/%postname%/

    with

    /%post_id%/%postname%/

    and the next/prev links are now functioning as expected.

    The site in question is hosted on a virtual server with Dreamhost. There is another WP blog on this server that is using

    /%category%/%postname%/

    without error. This blog is is associated with the "master user" on the account. The blog where the next/prev weren't working was also under this same user. So, I imagine the virtual nature of this second account is where the problems were with using the category permalink structure. Can an Apache head explain that out a bit more so I understand this more clearly?

    Also, I used %post_id% because I read somewhere that this would be better for performance. Can anyone explain why that is?

    Lastly, it would be great it the Permalink section in the Codex was updated to include this info about %category% not always working. I found a number of unanswered posts in the forum about next/prev link problems, some of which might be related to my issue.

    Thanks again, moshu!

Topic Closed

This topic has been closed to new replies.

About this Topic