Nov
30
Newasp 4.0 (新云)FOR IIS7 URL Rewrite
今天把所有的网站都移植到了windows server 2008的服务器上了,因为微软已经有了URL Rewrite这个模块了,就不需要安装ISAPI_Rewrite了,但是URL Rewrite的规则和ISAPI_Rewrite的有些不一样了,用了ISAPI_Rewrite的规则之后IIS提示404错误,于是参照了官方的帮助文件,终于把新云4.0的伪静态规则搞定了,在自己的网站测试一切正常,把以下代码复制到网站的配置文件web.config中的<system.webServer>之后就可以了。
<rewrite>
<rules>
<rule name="Imported Rule 1">
<match url="([A-Za-z0-9_-]+)/(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="{R:1}/show.asp?id={R:2}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 2">
<match url="([A-Za-z0-9_-]+)/(\d+)_(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/show.asp?id={R:2}&page={R:3}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 3">
<match url="([A-Za-z0-9_-]+)/list_(\d+)_(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/list.asp?page={R:2}&classid={R:3}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 4">
<match url="([A-Za-z0-9_-]+)/special-(\d+)-(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/special.asp?page={R:2}&specialid={R:3}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 5">
<match url="([A-Za-z0-9_-]+)/newlist-(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/shownew.asp?page={R:2}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 6">
<match url="([A-Za-z0-9_-]+)/bestlist-(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/showbest.asp?page={R:2}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 7">
<match url="([A-Za-z0-9_-]+)/hotlist-(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/showhot.asp?page={R:2}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 8">
<match url="([A-Za-z0-9_-]+)/ABC_([A-Za-z0-9_-]+)_1\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/showabc.asp?q={R:2}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 9">
<match url="([A-Za-z0-9_-]+)/tag-(.*)-(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/tag.asp?name={R:2}&page={R:3}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 10">
<match url="([A-Za-z0-9_-]+)/tag-(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/tag.asp?page={R:2}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 11">
<match url="([A-Za-z0-9_-]+)/Soft(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/softdown.asp?softid={R:2}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 12">
<match url="([A-Za-z0-9_-]+)/d(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/down.asp?id={R:2}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 13">
<match url="([A-Za-z0-9_-]+)/type-(.*)-(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/showtype.asp?type={R:2}&page={R:3}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 14">
<match url="([A-Za-z0-9_-]+)/comment-(\d+)-(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/comment.asp?id={R:2}&page={R:3}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 15">
<match url="([A-Za-z0-9_-]+)/fx-(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/downcopy.asp?id={R:2}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 16">
<match url="support/about.html" ignoreCase="false" />
<action type="Rewrite" url="/support/about.asp" />
</rule>
<rule name="Imported Rule 17">
<match url="support/advertise.html" ignoreCase="false" />
<action type="Rewrite" url="/support/advertise.asp" />
</rule>
<rule name="Imported Rule 18">
<match url="support/help.html" ignoreCase="false" />
<action type="Rewrite" url="/support/help.asp" />
</rule>
<rule name="Imported Rule 19">
<match url="support/contact.html" ignoreCase="false" />
<action type="Rewrite" url="/support/contact.asp" />
</rule>
<rule name="Imported Rule 20">
<match url="support/copyright.html" ignoreCase="false" />
<action type="Rewrite" url="/support/copyright.asp" />
</rule>
<rule name="Imported Rule 21">
<match url="support/declare.html" ignoreCase="false" />
<action type="Rewrite" url="/support/declare.asp" />
</rule>
<rule name="Imported Rule 22">
<match url="support/juanzhu.html" ignoreCase="false" />
<action type="Rewrite" url="/support/juanzhu.asp" />
</rule>
</rules>
</rewrite>
<rewrite>
<rules>
<rule name="Imported Rule 1">
<match url="([A-Za-z0-9_-]+)/(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="{R:1}/show.asp?id={R:2}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 2">
<match url="([A-Za-z0-9_-]+)/(\d+)_(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/show.asp?id={R:2}&page={R:3}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 3">
<match url="([A-Za-z0-9_-]+)/list_(\d+)_(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/list.asp?page={R:2}&classid={R:3}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 4">
<match url="([A-Za-z0-9_-]+)/special-(\d+)-(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/special.asp?page={R:2}&specialid={R:3}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 5">
<match url="([A-Za-z0-9_-]+)/newlist-(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/shownew.asp?page={R:2}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 6">
<match url="([A-Za-z0-9_-]+)/bestlist-(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/showbest.asp?page={R:2}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 7">
<match url="([A-Za-z0-9_-]+)/hotlist-(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/showhot.asp?page={R:2}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 8">
<match url="([A-Za-z0-9_-]+)/ABC_([A-Za-z0-9_-]+)_1\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/showabc.asp?q={R:2}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 9">
<match url="([A-Za-z0-9_-]+)/tag-(.*)-(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/tag.asp?name={R:2}&page={R:3}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 10">
<match url="([A-Za-z0-9_-]+)/tag-(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/tag.asp?page={R:2}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 11">
<match url="([A-Za-z0-9_-]+)/Soft(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/softdown.asp?softid={R:2}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 12">
<match url="([A-Za-z0-9_-]+)/d(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/down.asp?id={R:2}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 13">
<match url="([A-Za-z0-9_-]+)/type-(.*)-(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/showtype.asp?type={R:2}&page={R:3}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 14">
<match url="([A-Za-z0-9_-]+)/comment-(\d+)-(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/comment.asp?id={R:2}&page={R:3}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 15">
<match url="([A-Za-z0-9_-]+)/fx-(\d+)\.html" ignoreCase="false" />
<action type="Rewrite" url="/{R:1}/downcopy.asp?id={R:2}" appendQueryString="false" />
</rule>
<rule name="Imported Rule 16">
<match url="support/about.html" ignoreCase="false" />
<action type="Rewrite" url="/support/about.asp" />
</rule>
<rule name="Imported Rule 17">
<match url="support/advertise.html" ignoreCase="false" />
<action type="Rewrite" url="/support/advertise.asp" />
</rule>
<rule name="Imported Rule 18">
<match url="support/help.html" ignoreCase="false" />
<action type="Rewrite" url="/support/help.asp" />
</rule>
<rule name="Imported Rule 19">
<match url="support/contact.html" ignoreCase="false" />
<action type="Rewrite" url="/support/contact.asp" />
</rule>
<rule name="Imported Rule 20">
<match url="support/copyright.html" ignoreCase="false" />
<action type="Rewrite" url="/support/copyright.asp" />
</rule>
<rule name="Imported Rule 21">
<match url="support/declare.html" ignoreCase="false" />
<action type="Rewrite" url="/support/declare.asp" />
</rule>
<rule name="Imported Rule 22">
<match url="support/juanzhu.html" ignoreCase="false" />
<action type="Rewrite" url="/support/juanzhu.asp" />
</rule>
</rules>
</rewrite>