views:

362

answers:

4

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 turn no_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

+1  A: 

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

Tyson
A: 

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.

Arms
+1  A: 

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

Milton
Thanks for the link, and welcome to SO :)
Arms
A: 

can you please help me setup symfony on a IIS adminattalentedotro ? the tutorial not work for me ! I can browse only the first SF page than all the links are outputting

The page cannot be found

Petro