Skip to content

Instantly share code, notes, and snippets.

@paolostefan
Created October 25, 2018 12:03
Show Gist options
  • Save paolostefan/abd691ab106888600e640bc9354c2b74 to your computer and use it in GitHub Desktop.
Save paolostefan/abd691ab106888600e640bc9354c2b74 to your computer and use it in GitHub Desktop.
Basic web.config file for a Symfony website running on IIS
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<remove value="iisstart.htm" />
<remove value="Default.htm" />
<remove value="Default.asp" />
<add value="index.php" />
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="Symfony: Redirect index.php/anything to /anything" stopProcessing="true">
<match url="^index\.php(/(.*)|$)" ignoreCase="false" />
<action type="Redirect" url="/{R:2}" redirectType="Permanent" />
</rule>
<rule name="Symfony: Existing files" stopProcessing="true">
<match url=".?" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
</conditions>
<action type="None" />
</rule>
<rule name="Symfony: All the rest to index.php" stopProcessing="true">
<match url=".?" ignoreCase="false" />
<action type="Rewrite" url="/index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment