I’m trying to get ‘clean’ PathInfo style URLs with query string parameters working on PHP 5.3 and IIS 5.1 using FastCGI. I’ve found that I can use:
(1) http://www.example.com/index.php?/path/to/foo/
but not:
(2) http://www.example.com/index.php/path/to/foo/ (Note the missing ?)
Which isn’t a big issue until I want to mix URLs with a query string like:
(3) http://www.example.com/index.php?/path/to/foo/?color=blue&size=small
That makes my $_GET look like:
Array
(
[/myapp/foo/bar?colour] => blue
[size] => small
)
Is there way to get a URL scheme like (4) below to work, and with $_GET being populated correctly on IIS 5.1?
(4) http://www.example.com/index.php/path/to/foo/?color=blue&size=small
P.S. – I remember being able to do this before, but I suspect I was using Apache at the time and not IIS. Unable to use Apache for this. However the production server has IIS7 (I only have IIS 5.1 on my machine).
For (3), you simply need to treat the query-string as a single piece of text. You should not be using
$_GET– you should be using theQUERY_STRINGenvironment variable directly, instead. You should get/path/to/foo/?color=blue&size=small.For (4), you should concatenate the
PATH_INFOandQUERY_STRINGenvironment variables, joined with a?, and use that value. Again, you should get/path/to/foo/?color=blue&size=small. This is becausePATH_INFOhas/path/to/fooandQUERY_STRINGhascolor=blue&size=small.