Skip to content

Instantly share code, notes, and snippets.

@SteGriff
Created February 7, 2016 16:30
Show Gist options
  • Save SteGriff/5f64337a07694b54d782 to your computer and use it in GitHub Desktop.
Save SteGriff/5f64337a07694b54d782 to your computer and use it in GitHub Desktop.
Sensible rewrite-all-to-index for PHP on IIS
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="SpecificRewrite" stopProcessing="true">
<match url="^" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
@SteGriff
Copy link
Author

SteGriff commented Feb 7, 2016

This will redirect host.local/long/winded/url to host.local/index.php but it will leave host.local/img/dog.png untouched because it is a real file

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