当前位置: 动力学知识库 > 问答 > 编程问答 >

asp.net - regular expression needed to rewrite URLs

问题描述:

I am trying to make a rewrite rule to check whether the URL ends with .htm or .html, but does not contain Archive.aspx.

The url starts out like

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

and ends up like

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

How can I do this with a regular expression?

网友答案:

You can use negative lookahead: (?!Archive\.aspx).*\.html?$

分享给朋友:
您可能感兴趣的文章:
随机阅读: