Skip to content

Instantly share code, notes, and snippets.

@nurbek-ab
Forked from lennart/gist:3787187
Last active June 24, 2024 19:55
Show Gist options
  • Save nurbek-ab/9c2997441fcaa2e52b0a to your computer and use it in GitHub Desktop.
Save nurbek-ab/9c2997441fcaa2e52b0a to your computer and use it in GitHub Desktop.
IIS rewrite rule for Symfony 2 (use at root directory)
<?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_local.php?{R:2}" logRewrittenUrl="true"/>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment