The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

next_posts_link and pevious_posts_link adding extra directory to URL (1 post)

  1. nalybuites
    Posted 5 years ago #

    First here's the setup: I hosting my own WP installation on my personal box, using DynDNS to get around dynamic IP addressing. There are multiple blogs hosted via a multisite installation using subfolders (can't use subdomains due to DynDNS). The blogs use different themes. My permalink structure for both blogs is /year/monthnum/day/postname/ and to the best of my knowledge, the .htaccess file is correct:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]
    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
    RewriteRule  ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]

    Next is the problem: Let's say the main page of my two sites are at http://user.dyndns.com/blog and http://user.dyndns.com/pictures respectively. At the bottom the page for both themes are the pagination links for previous and next posts (10 per page). That link goes to http://user.dyndns.com/blog/blog/page/# and http://user.dyndns.com/pictures/pictures/page/# (where # is the page number), respectively. This results in a 404 error. I think I've narrowed down the problem to the get_pagenum_link function in wp-includes/link-template.php but I don't understand the code well enough to find out exactly where the problem is. This may have been happening with 3.1 as well.

    Live example at http://nalybuites.homedns.org/blorg

Topic Closed

This topic has been closed to new replies.

About this Topic