PHP/IIS index page must be explicitly specified to use GET vars?
January 20, 2006 12:57 PM   Subscribe

PHP under IIS doesn't serve default content page (index.php) when only GET variables are passed? e.g., /directory/?myvar=foobar ...I have a custom 404 error configured, and IIS is set to confirm file exists.

I just installed WordPress 2.0, and it works great, except for when it tries to pass GET variables straight to its base URL, which is just /directory/, not /directory/index.php. The error returned is, predictably, "The specified file could not be found." which is what IIS throws when you call a non-existant php page unless you have "confirm file exists" flagged, which I do.

I have mod_rewrite installed, but do not speak regexp (I know, I should). Would it be possible to rewrite calls to this directory to append index.php? Could someone please provide the regular expression?

Or another solution?
(And yes, I know I'm doing a tricked-out tango with IIS and PHP, but CTO won't let me get a *nix box. )
posted by CaptApollo to Computers & Internet (5 answers total)
 
You do have index.php listed in IIS as a default file for that domain or directory, right? Because on my machine, that works fine -- see http://www.jerrykindall.com/statler/ vs http://www.jerrykindall.com/statler/?test=test. (I'm not using PHP for that, but it shouldn't make any difference.)
posted by kindall at 1:06 PM on January 20, 2006


Response by poster: Yup. I have an extensive PHP site and a slew of other programs running without issue. I think it is the combo of PHP and IIS that is causing the issue.

Some more info:
- index.php is served at /directory/
- My custom 404 is served at /directory/garbage
- My custom 404 is served at /directory/garbage.php
- "The specified file cannot be found." is thrown by /directory/?myvar=whatver
posted by CaptApollo at 1:16 PM on January 20, 2006


(And yes, I know I'm doing a tricked-out tango with IIS and PHP, but CTO won't let me get a *nix box. )

My recommendation would be turning off IIS and installing Apache -- you can use it on a Windows box.
posted by camcgee at 1:47 PM on January 20, 2006


Just to backup camcgee, MetaFilter runs on Windows 2003 Server running Apache, but then I don't have any ASP here so the switch was easy.
posted by mathowie at 1:52 PM on January 20, 2006


Best answer: No, IIS does not do that. It's really annoying. The programmers didn't believe in a directory listing being something that can accept parameters so it just gives up instead of passing the parameters to your script.

Try this:

RewriteRule /(\?.*) /index.php$1

By the way, there's absolutely no way to POST to index.php unless you explicitly write out index.php, as far as I can tell. IIS just blows up if you try that since *obviously* directory listings can't be POSTed to... sigh.

I second the recommendation to use Apache instead if you have a choice.
posted by Khalad at 12:17 AM on January 21, 2006


« Older Speciation and Chromosome Counts   |   John Birch: Real, or pipe dream? Newer »
This thread is closed to new comments.