I've been battling to set up my Symfony project on a IIS web server, but have got it pretty much working.
I still can't get the nice URLs working though. When I use my dev environment, url_for
generates URLs that look like .../frontend_dev.php/booking/create
and everything works fine. But as soon as I use the prod environment url_for
generates URLs that look like .../booking/create
, which don't work presumably because of problems with the rewrite setup on IIS.
I don't want to try and get the proper rewrite working on IIS - I've stuffed around with that for ages now and have given up. If you have a silver bullet to fix my problem then I'd love to know but that's not really what the question is about.
I've found that calling .../index.php/booking/create
works fine. Therefore I can fix my problem simply by ensuring that url_for
always adds the filename. But how can I do this? I thought it might be just assuming index.php
, so I made a copy called frontend.php
but it still generates nice URLs, without the filename. It seems that if it's the dev environment, it adds the file, but if it's the prod environment, it hides it. Any ideas on how to override this?
In apps/appname/config/settings.yml
, set no_script_name
to false
.
See the symfony Reference Book.