IIS 7-不会触发重写规则,但可以与重定向一起使用 [英] IIS 7 - Rewrite rule not firing, but does work with Redirect

查看:47
本文介绍了IIS 7-不会触发重写规则,但可以与重定向一起使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在IIS 7上设置了以下重写规则:

I have the following rewrite rule set up on IIS 7:

<rule name="Rewrite /publicfiles/GUID/file.ext" stopProcessing="true">
    <match url="^/?publicfiles/(.*)/(.*)" />
<action type="Rewrite" url="http://www.domain.tld" appendQueryString="false" /
</rule>

当我尝试时,它似乎没有触发.我收到404错误,但如果将类型更改为重定向",则会触发并将我发送到指定的URL.有人可以对此有所启发吗?

When I try it out it appears to not fire. I get a 404 error, but if I change the type to Redirect it fires and sends me to the URL specified. Is someone able to shed some light on this?

我将规则的定义添加到了IIS服务器而不是站点的web.config中,然后运行良好.但是,这不太可行,因为我需要为各个站点配置规则.有什么想法吗?

I added the definition of the rule to the web.config of my IIS server rather than my site and then it worked perfectly. However this is not very feasible as I need to configure the rule for individual sites. Any ideas?

推荐答案

毕竟与全局规则无关.原来,我必须安装应用程序请求路由",然后才能使用站点规则:)

It wasn't about the global rule after all. It turned out I had to install Application Request Routing and then it worked with a site rule :)

这篇关于IIS 7-不会触发重写规则,但可以与重定向一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆