I’ve been working on a small link length supressor site and can’t seem to figure it out on IIS7. I’m used to working on isapi rewrite and mod_rewrite.
The following scenario is active:
Lets say I have test.com, thats the main domain. The domain should process all files normally. But when the /.* isn’t a directory nor a file, it should send it to redirect.asp?text=(.*).
This is what my web.config looks like
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="YOURLS 1" stopProcessing="true">
<match url="^([0-9A-Za-z-]+)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="redirect.asp?test={R:1}" appendQueryString="false" />
</rule>
</rules>
</rewrite>
</system.webServer>
It seemed to have to do with a wrong version of the URL rewriter. I installed the latest 2.0 and it was fixed!