2012-11-22 108 views
1

我一直在研究一个小链接长度supressor网站,似乎无法在IIS7上找到它。我习惯于在isapi rewrite和mod_rewrite上工作。IIS7 URL重写短url

以下情形是活动的:
可以说我有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> 

回答

0

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

0

看不到太多的错误与您的规则,也许除了你使用test(有一个“s”)作为查询字符串参数在你的web.config中,但在你的文本中你说它应该是text。一个错字或者也许这就是它不工作的原因?

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

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