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

Computer Guru computerguru at neosmart.net
Sun Oct 22 12:43:47 GMT 2006

I'm porting my site over to IIS and it's going great, but for one thing: I
don't like "index.php" at the end of a url, so I have a quick script that
removes it.

$blog_sub = "wordpress";

if ($_SERVER['REQUEST_URI'] == "/" . $blog_sub . "/index.php") {
header('HTTP/1.1 301 Moved Permanently');
header('Location: ' . "http://" . $_SERVER['HTTP_HOST'] . "/" . $blog_sub .

Per http://trac.wordpress.org/ticket/1488, IIS doesn't have REQUEST_URI, it
uses SCRIPT_NAME instead - but there's a problem.

Whenever I ran this I'd get an infinite loop... In the end I realized that
REQUEST_URI and SCRIPT_NAME aren't equal: the first is the name of the
script the end user called for, the latter is the actual script being run.
With SCRIPT_NAME, /index.php and / are exactly the same thing. They both
point to index.php and give me hell.

Does anyone know of a way on IIS to check the actual path requested and not
the script being engaged? 

I can think of several other plugins that I am using (many of them not mine)
that need this info for proper IIS compatibility as well......

Any ideas? This (http://www.php.net/reserved.variables) is of no use.

Computer Guru
NeoSmart Technologies

More information about the wp-hackers mailing list