WordPress.org

Support

Support » How-To and Troubleshooting » next_posts_link Templage Tag fails with .htaccess rewrite

next_posts_link Templage Tag fails with .htaccess rewrite

  • 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.

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘next_posts_link Templage Tag fails with .htaccess rewrite’ is closed to new replies.
Skip to toolbar