Coldfusion 9& IIS7 URL重写

时间:2014-09-15 15:20:06

标签: iis-7 coldfusion rewrite

我目前正在研究如何实施网址重写,并且想知道是否有人可以提供一些帮助。

我们目前的网址结构如下..

http://example.com/products.cfm?id=1234

http://example.com/recipes.cfm?id=6789

我想配置IIS,以便可以将URL重写为以下(或类似的)

http://example.com/products/1234/product-title-here

http://example.com/recipes/6789/yummy-recipe-ever

我将如何做到这一点?

2 个答案:

答案 0 :(得分:1)

查看Coldbox,其中包含rewrite.ini和IS7 web.config http://wiki.coldbox.org/wiki/URLMappings.cfm

Coldbox博客分享了此链接 http://blog.coldbox.org/blog/coldbox-and-url-rewrites-with-iis-7

答案 1 :(得分:1)

通读this walk through。这个例子接近你想要的(用cfm代替aspx)。

<rewrite>
  <rules>
    <rule name="Rewrite to article.aspx">
      <match url="^article/([0-9]+)/([_0-9a-z-]+)" />
      <action type="Rewrite" url="article.cfm?id={R:1}&title={R:2}" />
    </rule>
  </rules>
</rewrite>