Iis 7 IIS7短URL的URL重写

Iis 7 IIS7短URL的URL重写,iis-7,url-rewriting,Iis 7,Url Rewriting,我一直在一个小链接长度抑制网站上工作,似乎无法在IIS7上找到它。我习惯于isapi重写和mod_重写 以下场景处于活动状态: 假设我有test.com,那是主要的域名。域应正常处理所有文件。但是当/.*既不是目录也不是文件时,它应该将其发送到redirect.asp?text=(.*) 这就是我的web.config的样子 <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServe

我一直在一个小链接长度抑制网站上工作,似乎无法在IIS7上找到它。我习惯于isapi重写和mod_重写

以下场景处于活动状态:
假设我有test.com,那是主要的域名。域应正常处理所有文件。但是当
/.*
既不是目录也不是文件时,它应该将其发送到
redirect.asp?text=(.*)

这就是我的web.config的样子

<?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>


看不出您的规则有什么错误,除了在
web.config
中使用
test
(带一个“s”)作为查询字符串参数之外,但在文本中您说它应该是
text
。是打字错误还是这就是它不起作用的原因

        <action type="Rewrite" url="redirect.asp?text={R:1}" appendQueryString="false" />


这似乎与URL重写器的错误版本有关。我安装了最新的2.0,它已修复

不,不是。似乎是URL重写器有问题。我安装了1.5,但它不工作。我已经使用webinstaller升级到2.0,它似乎工作得很好!谢谢你的帮助。