ZF-25: Zend_Controller_Router breaks on IIS due to differences between IIS and Apache (TRAC#2)

Issue Type: Bug Created: 2006-06-19T22:46:13.000+0000 Last Updated: 2007-07-05T14:44:27.000+0000 Status: Closed Fix version(s): - 0.1.4 (29/Jun/06)

Reporter: Zend Framework (zend_framework) Assignee: Michal Minicki (martel) Tags: - Zend_Controller

Related issues: Attachments:


Hi friends,

When I was making a test running Zend Framework on IIS Server I've stopped by a problem. After some tests I've found a bug at this line: The bug occurs because when you put as your's url the apache server returns, but IIS returns or your default page.

That action causes a crash at the 71th line of library\zend\controllers\route.php, where strlen($controller) now will not return 0 but 9 (if index is your default page) and 'index.php' isn't a controller, then noRouteAction will be selected, returning to index.php, this error will be again and will return to index again.... and thus successively.

sorry by disturb, and congratulations for the good job,

Bruno Eduardo de resende Oliveira


Posted by Zend Framework (zend_framework) on 2006-06-19T22:46:53.000+0000

05/05/06 08:41:33: Modified by

I'm running ZF on IIS. It functions great with a small workaround. You have to install Isapi_Rewrite ( to get mod_rewrite-like functionality in IIS. Then in Zend_Controller_Router you only need to change line 52 in Zend/Controller/Router.php from

$path = $_SERVER['REQUEST_URI'];


$path = strtolower($_SERVER['HTTP_X_REWRITE_URL']);

Isapi_Rewrite sets the HTTP_X_REWRITE_URL $_SERVER variable to be what REQUEST_URI would be if you were running on Apache and using mod_rewrite.

I hope that helps. 06/12/06 06:22:42: Modified by Link

Posted by Michal Minicki (martel) on 2006-06-23T10:30:59.000+0000

Could you provide working isapi rewrite rules? I'm trying those and they don't seem to work on my setup:

RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule ^.*$ index.php

And this also doesn't work:

RewriteRule !.(js|ico|gif|jpg|png|css|swf)$ index.php

Posted by Michal Minicki (martel) on 2006-06-26T10:20:41.000+0000

I have found a working rewrite rule: RewriteRule (?!.(js|ico|gif|jpg|png|css|swf))$ index.php

Router works as expected. Without any changes to the code.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.