Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 重写URL所需的正则表达式_Asp.net_Regex_Url Rewriting - Fatal编程技术网

Asp.net 重写URL所需的正则表达式

Asp.net 重写URL所需的正则表达式,asp.net,regex,url-rewriting,Asp.net,Regex,Url Rewriting,我正在尝试制定重写规则,以检查URL是否以.htm或.html结尾,但不包含Archive.aspx url开始时如下所示 www.contoso.com/test.htm (or .html) 结果就像 www.contoso.com/Archive.aspx?page=/test.htm 如何使用正则表达式执行此操作?您可以使用负前瞻:(?!Archive\.aspx)。*\.html?$您可以使用负前瞻:(?!Archive\.aspx)。*\.html?$

我正在尝试制定重写规则,以检查URL是否以
.htm
.html
结尾,但不包含
Archive.aspx

url开始时如下所示

www.contoso.com/test.htm  (or .html)
结果就像

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

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

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