Mod rewrite IIS ColdFusion中的目录特定url重写

Mod rewrite IIS ColdFusion中的目录特定url重写,mod-rewrite,iis,coldfusion,Mod Rewrite,Iis,Coldfusion,我有一个网站 http://example.com/school/student.cfm?id=100 另外,我还有另一个链接http://example.com/collage/student.cfm?id=200 我想写一个URL重写规则,它总是重写http://example.com/school/student.cfm?id=100 到http://example.com/school/student/100 及 http://example.com/collage/student.cf

我有一个网站
http://example.com/school/student.cfm?id=100

另外,我还有另一个链接
http://example.com/collage/student.cfm?id=200

我想写一个URL重写规则,它总是重写
http://example.com/school/student.cfm?id=100
到<代码>http://example.com/school/student/100

http://example.com/collage/student.cfm?id=200
到<代码>http://example.com/collage/student/200

我已经写了这样的规则,但它将始终使用1个目录,但我希望这是所有目录的工作

<rule name="Redirect to school with ONE parameter" stopProcessing="true">
    <match url="^.*/([^/]+)/?$" />
        <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
        </conditions>
    <action type="Rewrite" url="school/student.cfm?id_Name={R:1}" />
</rule> 

有很多方法可以解决这个问题。解决方案的范围从只重写学校和拼贴到重写以学生为终点的任何路径,再到使用重写一切的通用模式

要了解如何使用IIS的regexp执行此操作,请执行以下操作:

<match url="^(collage|school)/student/([0-9]+)/?$" />
<action type="Rewrite" url="{R:1}/student.cfm?id={R:2}" />

<match url="^([^/]+)/student/([0-9]+)/?$" />
<action type="Rewrite" url="{R:1}/student.cfm?id={R:2}" />

<match url="^([^/]+)/([^/]+)/([0-9]+)/?$" />
<action type="Rewrite" url="{R:1}/{R:2}.cfm?id={R:3}" />

出色的工作就像魅力一样。它解决了我的问题。谢谢你:)