How to pass parameter in wordpress url?

PHP/IIS index page must be explicitly specified to use GET vars?

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

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

CaptApollo at Ask.Metafilter.Com Visit the source

Was this solution helpful to you?

Other answers

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

kindall

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

CaptApollo

(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 http://www.apache.org/ -- you can use it on a Windows box.

camcgee

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.

mathowie

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.