Skip to content

Instantly share code, notes, and snippets.

@mjau-mjau

mjau-mjau/web.config

Last active May 24, 2020
Embed
What would you like to do?
X3 web.config for Microsoft IIS server
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<!-- Prevent web access to all files in the /config/ directory -->
<security>
<requestFiltering>
<hiddenSegments>
<add segment="config" />
</hiddenSegments>
</requestFiltering>
</security>
<!-- X3 rewrite rules -->
<rewrite>
<rules>
<!-- Rewrite any calls to *.html, *.json, *.xml, *.atom or *.rss if a folder matching * exists -->
<rule name="Rewrite any calls to *.html, *.json, *.xml, *.atom or *.rss if a folder matching * exists" stopProcessing="false">
<match url="(.+)\.(html|json|xml|atom|rss)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="{R:1}/" />
</rule>
<!-- Add a trailing slash to directories -->
<rule name="Add a trailing slash to directories" stopProcessing="false">
<match url="([^/]+)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{URL}" pattern="(\.|\?)" ignoreCase="false" negate="true" />
<add input="{URL}" pattern="(.*)/$" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="{R:1}/" />
</rule>
<!-- Rewrite any calls to /render to the image parser -->
<rule name="Rewrite any calls to /render to the image parser" stopProcessing="false">
<match url="^render/." ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{URL}" pattern="render/" ignoreCase="false" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="app/parsers/slir/" />
</rule>
<!-- Rewrite routes to index.php if they are non-existent files/dirs -->
<rule name="Rewrite routes to index.php if they are non-existent files/dirs" stopProcessing="false">
<match url="^(.*)/$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?/{R:1}/" appendQueryString="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
You can’t perform that action at this time.