[wp-trac] [WordPress Trac] #4229: No trailing slash on root dir
breaks posts_nav_link
WordPress Trac
wp-trac at lists.automattic.com
Mon May 7 16:22:50 GMT 2007
#4229: No trailing slash on root dir breaks posts_nav_link
-------------------------+--------------------------------------------------
Reporter: mediafetish | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone:
Component: General | Version:
Severity: normal | Keywords: posts_nav_link
-------------------------+--------------------------------------------------
I've never submitted a bug so bear with me - I did a search prior to
submitting and couldn't find this...
Found this in wpmu but the source came from wp - we had a problem where if
you visit one of our blogs without the trailing slash -
(blogs.example.com/subblog) the the paging features of posts_nav_link
would produce funky links like blogs.example.com/subblog/subblog/page/2/
(notice the doubled 'subblog')
Some digging led to:
In link-template.php find (wpmu 1.2.1 - not sure about other versions or
wp):
{{{
$home_root = trailingslashit($home_root);
}}}
and change it to
{{{
$home_root = untrailingslashit($home_root);
}}}
Doing this made it so that this block:
{{{
$home_root = parse_url(get_option('home'));
$home_root = $home_root['path'];
$home_root = untrailingslashit($home_root);
$qstr = preg_replace('|^'. $home_root . '|', '', $qstr);
$qstr = preg_replace('|^/+|', '', $qstr);
}}}
sets the value of $qstr to the same thing regardless of whether the path
in the browser ends with a slash or not.
The old way (with 'trailingslashit') would try to match home_root
(blogs.example.com/subblog/) against the path in the browser
(blogs.example.com/subblog) which doesn't match.
--
Ticket URL: <http://trac.wordpress.org/ticket/4229>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list