[wp-hackers] REQUEST_URI on IIS isn't SCRIPT_NAME

Computer Guru computerguru at neosmart.net
Mon Oct 23 08:18:40 GMT 2006


> 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.

Computer Guru
NeoSmart Technologies
http://neosmart.net/blog/



More information about the wp-hackers mailing list