WordPress.org

Ready to get started?Download WordPress

Forums

next_posts_link Templage Tag fails with .htaccess rewrite (5 posts)

  1. deko
    Member
    Posted 7 years ago #

    The template tags next_posts_link and previous_posts_link should work from the index.php template... BUT...

    If you are doing an .htaccess rewrite to arrive at your index.php, these tags will fail.

    The function responsible may be:

    get_pagenum_link() in template-function-links.php (at line 389).

    I noticed this line of code:

    $qstr = wp_specialchars($_SERVER['REQUEST_URI'])

    The value returned by this line is what appears to be buttering up the link that is returned by next_posts_link.

    For example, if your site is www.example.com, and you use htaccess to direct visitors to:

    example.com/my-dir/wp-dir/
    (where wp-dir is wp install directory)

    the link returned by next_posts_link will look like this:

    http://www.examle.com/my-dir/wp-dir/my-dir/wp-dir/index.php?paged=5

    Obviously this will return a 404 error -- so you will not be able to navigate through your posts.

    I discovered this problem recently and am still looking for a solution.

  2. deko
    Member
    Posted 7 years ago #

    Is anyone familiar with that get_pagenum_link() function?

    I miss my next_posts_link Template Tag...

  3. deko
    Member
    Posted 7 years ago #

    There must be some way to hardcode the correct path rather than using the return value of the function.

    Any suggestions on how to do this?

  4. BlogMasterG
    Member
    Posted 7 years ago #

    I'm having a similar issue, and it sounds like it could be related to this.

    I'm running WP 2.1 on Win2003/IIS 6. If you use the previous/next links (next_posts_link / previous_posts_link) at the bottom of my category pages - like this:

    http://www.articulate.com/blog/category/tips-n-tricks-ap/page/2/

    ...index.php is added directly after /blog when it should be implicit at the end of the URL:

    http://www.articulate.com/blog/index.php/category/tips-n-tricks-ap/page/3/

    deko- Did you ever resolve this issue?

  5. tyleroakleaf
    Member
    Posted 7 years ago #

    I'm also very interested, as I have the exact some problem.

Topic Closed

This topic has been closed to new replies.

About this Topic