重写URL所需的正则表达式

时间:2010-10-05 22:44:59

标签: asp.net regex url-rewriting

我正在尝试制作重写规则,以检查网址是以.htm还是.html结尾,但不包含Archive.aspx

网址开头就像

www.contoso.com/test.htm  (or .html)

最终会像

一样
www.contoso.com/Archive.aspx?page=/test.htm

如何使用正则表达式执行此操作?

1 个答案:

答案 0 :(得分:1)

您可以使用否定前瞻:(?!Archive\.aspx).*\.html?$