[wp-hackers] REQUEST_URI on IIS isn't SCRIPT_NAME
Alex King
lists at alexking.org
Mon Oct 23 17:59:12 GMT 2006
I've had success with this:
$_SERVER['REQUEST_URI'] = ( isset($_SERVER['REQUEST_URI']) ? $_SERVER
['REQUEST_URI'] : $_SERVER['SCRIPT_NAME'] . (( isset($_SERVER
['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : '')));
Cheers,
--Alex
Personal http://alexking.org
Business http://kingdesign.net
On Oct 23, 2006, at 2:18 AM, Computer Guru wrote:
>> Tried dumping $_SERVER to see if there's anything useful there? MSDN
>> list[1] a couple of possible variables: URL, UNENCODED_URL,
>> HTTP_URL...
>
> No, none of them work... They all return the actual script's path
> instead of
> the virtual directory or alias.
>
> I found something that'll suffice: $_SERVER['PATH_TRANSLATED'];
> It's nonsense, it takes apache's REQUESTED_URI and prepends the
> document
> root, such that for a page titled "About" in WP it would show
> C:\Inetpub\wwwroot\wordpress\about
>
> No point to it as far as I can see, but by
>
> $REQUESTE_URI = str_replace("\", "/", str_replace($_SERVER
> ["DOCUMENT_ROOT"],
> "", $_SERVER['PATH_TRANSLATED']));
>
> Seems to work.
>
> Hackaday job... but it'll do the trick.. I bet this changes from
> IIS to IIS,
> it just doesn't seem right. But it'll do well enough for my
> implementation.
More information about the wp-hackers
mailing list