Skip to content

Instantly share code, notes, and snippets.

@lennart
Created September 26, 2012 10:16
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lennart/3787187 to your computer and use it in GitHub Desktop.
Save lennart/3787187 to your computer and use it in GitHub Desktop.
Web Config for Symfony 2 in WebMatrix 2
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="TempRewriteToWeb" stopProcessing="false">
<match url="^(web/)?(.*)$" />
<action type="Rewrite" url="web/{R:2}" logRewrittenUrl="true" />
</rule>
<rule name="StaticFiles" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_FILENAME}" matchType="IsFile"/>
</conditions>
<action type="Rewrite" url="{R:0}" logRewrittenUrl="true" />
</rule>
<rule name="RewriteRequestsToPublic" stopProcessing="true">
<match url="^(web/)(.*)$" />
<action type="Rewrite" url="web/app_dev.php?{R:2}" logRewrittenUrl="true"/>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
@tvl83
Copy link

tvl83 commented Jan 20, 2014

Thank you! :) Worked like a charm.

I am surprised they don't have something like this in their official documentation.

@elvis2
Copy link

elvis2 commented Feb 28, 2015

Thank you! Thank you!

After banging my head for hours configuring iis, swapping out isapi with .htaccess files and digging for any good subject material, I found this. This worked after I altered the iis application pool and restarted it and the website.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment