IIS7删除文件扩展名

我试图configurationIIS7(Windows Server 2008),以便我可以使用不包含文件扩展名的URL(即somepage.php将成为http:// DOMAIN / somepage )

我在IIS7中使用URL重写工具,并具有以下规则:

匹配url

Requested URL - Matches the pattern Using: Wildcards Pattern: /* No conditions. 

行动

 Action Type: Rewrite Action properties - Rewrite URL: {R:1}.php, append query string 

这是返回一个404错误。 当我使用testing模式工具时,它似乎工作,而R:1是我想在文件扩展名之前添加的。 任何帮助或想法将不胜感激!

谢谢!

您需要更改规则以使用正则expression式而不是通配符。 这是因为R:1是一个正则expression式反向引用。

另外 – 你可能希望你的模式是(。*),它是R:1(最有可能是R:0没有parens – R:0是“整个匹配”的反向引用)

查看http://learn.iis.net/page.aspx/497/user-friendly-url—rule-template/关于URL重写的用户友好URL部分的大量信息。