[wp-trac] [WordPress Trac] #19688: Using pathinfo permalinks in a subdirectory causes some 404's
WordPress Trac
wp-trac at lists.automattic.com
Thu Dec 29 20:09:11 UTC 2011
#19688: Using pathinfo permalinks in a subdirectory causes some 404's
--------------------------+-----------------------------
Reporter: mose9634 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Permalinks | Version: 3.3
Severity: normal | Keywords:
--------------------------+-----------------------------
Due to circumstances beyond my control, I have a Wordpress site that must
be installed to a subfolder named "s". I also must use pathinfo type
permalinks - thus a page with a slug of store-locator would have the url
/s/index.php/store-locator. Unfortunately this results in a 404, but other
pages on the site work properly.
I tracked this down, and what I found is that code in
class_wp->parse_request is causing this - particularly the code starting
around line 166ish in version 3.3. The lines in particular that mess
things up are these three:
$pathinfo = trim($pathinfo, '/');
$pathinfo = preg_replace("|^$home_path|", '', $pathinfo);
$pathinfo = trim($pathinfo, '/');
Coming into these lines of code, $pathinfo is /store-locator/, but after
those three lines of code $pathinfo is tore-locator (the leading s is
missing). This is because $home_path comes from home_url() which strips
trailing slashes. The code right before this block further strips
$home_path down to just the subdirectory portion, which in my case is just
"s". Then the preg_replace fires and the leading s on the path is lost.
Temporarily, I added the following line before the three lines above and
my problems went away:
$home_path .= "/";
Obviously this only works in my particular situation, and I'd like to be
able to run vanilla Wordpress, but I can't find any combination of
settings that will preserve my required permalink structure and still
work. If there's a configuration combination that I'm missing, I'd be very
happy, otherwise, feel free to contact me if you would like more info or
if I can help in any way.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19688>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list