[wp-hackers] PATH_INFO permalinks problem and proposed fix
Dennis Williamson
dennis at netstrata.com
Tue Oct 19 20:34:58 UTC 2004
I've been having problems with PATH_INFO permalinks on a hosted IIS server
and, with the help of the excellent tech support at my ISP, found that
cgi.fix_pathinfo needed to be set to 1.
Now that I'm no longer getting the "No input file specified" error,
however, I'm in the middle of debugging WP to find out why it's letting all
posts through when I click on a permalink that should select a subset of
the posts.
What I've found so far is that $REQUEST_URI is getting a '?' appended to it
in this code from wp-settings.php:
// Fix for IIS, which doesn't set REQUEST_URI
$_SERVER['REQUEST_URI'] = ( isset($_SERVER['REQUEST_URI']) ?
$_SERVER['REQUEST_URI'] : $_SERVER['SCRIPT_NAME'] . ((
isset($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : '')));
The last isset is returning TRUE, even when there's no query string
because, at least on my server, $_SERVER['QUERY_STRING'] **exists** even
though it's empty.
In the following code, I check for it to exist and then whether it's null
before I append the query string. I've broken out the test expression into
a couple of ifs in order to avoid getting really messy.
// Fix for IIS, which doesn't set REQUEST_URI
$_SERVER['REQUEST_URI'] = (isset($_SERVER['REQUEST_URI']) ?
$_SERVER['REQUEST_URI'] : $_SERVER['SCRIPT_NAME']);
// append the query string if it exists and isn't null
if (isset($_SERVER['QUERY_STRING'])) {
if ('' != $_SERVER['QUERY_STRING'])
$_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
}
If this is something that applies to more than just me, I'll post it on
mosquito. I've checked CVS and the code there is the same as above.
Please weigh in if you have any comments.
Dennis
More information about the hackers
mailing list