Question

I have a Symfony project on a Win XP / IIS 7 machine with Isapi rewrite installed. When I go to the frontend (my main) application, it seems that the routing simply doesn't work. I always end up on my default module/action. However, if I turnno_script_name = off (in the app's settings.yml file) then everything works fine. I also have an admin app as part of the project (which also has no_script_name = off) and this works fine as well. This seems like it should be a simple problem, yet we've been working on this for 4 hours now. Any help would be greatly appreciated, thanks.

Edit: I changed the front controller's environment to dev in order to use the debug toolbar and found that no matter what my URL looks like, it always says

Match route "homepage" (/) for / with parameters array ( 'module' => 'default', 'action' => 'index',)

No matter what I do, module always equals default

Was it helpful?

Solution 2

I've found the solution. I added this code to the top of my index.php

$_SERVER['REQUEST_URI'] = $_SERVER['HTTP_X_REWRITE_URL'];

I tried everything within the Symfony on IIS tutorial (http://trac.symfony-project.org/wiki/symfonyOnIIS) and nothing made a difference. If anyone else runs into this problem, please try adding the above code first before mucking with any settings or .htaccess rules.

OTHER TIPS

IIS doesn't support URL rewriting very well, which is a requirement of Symfony's routing to work. Essentially, the webserver is supposed to redirect all requests to non-existing files/paths to Symfony's index.php, passing along with it the original URL requested. Symfony decodes this URL and applies its routing rules.

But, it's possible. You'll need to follow this: Symfony on IIS

Check out the new Url Rewrite module for IIS:

http://learn.iis.net/page.aspx/734/url-rewrite-module/

It even adds a tool to IIS manager which imports and converts mod_rewrite rules

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top