拦截url重写模块,防止重写

发布于 2024-12-05 12:51:41 字数 535 浏览 0 评论 0原文

是否有什么因素会导致 IIS 中的 url 重写模块无法启动?也许是处于集成模式或 http 处理程序的站点?

我尝试了一些不同的方法来使重写规则发挥作用,但一无所获。我的最新的就是这样

<rewrite>
      <rewriteMaps>

      </rewriteMaps>
      <rules>
        <rule name="rewriterule" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
          <match url="*" />

          <action type="Redirect" url="http://www.google.com" />
        </rule>
      </rules>
    </rewrite>

,根本不起作用。我尝试过各种正则表达式等。它就像没有被使用。

Is there anything that would cause the url rewrite module in IIS to not fire off? Maybe a site that is in integrated mode or an http handler?

I have tried a few different things to get the rewrite rules to work but nothing. My latest is as such

<rewrite>
      <rewriteMaps>

      </rewriteMaps>
      <rules>
        <rule name="rewriterule" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
          <match url="*" />

          <action type="Redirect" url="http://www.google.com" />
        </rule>
      </rules>
    </rewrite>

and it doesn't work at all. I've tried various regex, etc. Its like it doesnt get used.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

忘年祭陌 2024-12-12 12:51:41

似乎您已经有了答案,但这里还有一些其他可能导致重写模块无法工作的事情:

  • 当您部署网站并看到此功能无法工作时
    您的服务器,很可能您配置错误
    在您的服务器上。您可能进行的错误配置之一可能是
    将以下规则的 overrideModeDefault 属性设置为 Deny
    applicationHost.config 中的
    文件。

  • 如果您位于共享托管环境并且看到此功能
    不工作,然后询问您的提供商是否已为您提供
    配置此部分的权限。

  • 在您的开发环境中,如果您在
    Visual Studio Development Sever,您将看不到此内容
    功能工作。您需要配置您的应用程序以在
    至少 IIS Express 才能看到此功能正常工作。

Seems like you have your answer but here are some other possible things that might cause Rewrite Module not to work :

  • When you deploy your web site and see this feature not working on
    your server, it is highly possible that you misconfigured something
    on your server. One of the misconfiguration you might have done could
    be setting the overrideModeDefault attribute to Deny for rules under
    <sectionGroup name="rewrite"> inside your applicationHost.config
    file.

  • If you are on a shared hosting environment and you see this feature
    not working, then ask your provider if they have given you the
    permission of configuring this part.

  • In your development environment, if you run your web site under
    Visual Studio Development Sever, you won’t be able to see this
    feature working. You need to configure your application to run under
    at least IIS Express to see this feature working.

彼岸花似海 2024-12-12 12:51:41

在我的例子中,答案是您必须在与 url 重写模块相同的目标平台上运行该站点。例如,我安装了 x64 版本的 url 重写模块,但该网站在 32 位下运行。一旦我将站点设置为在 64 位下运行,重写就开始工作。

The answer in my case is that you have to be running the site in the same target platform as the url rewrite module. for example, I have x64 version of url rewrite module installed but the site was running under 32bit. Once I setup the site to run under 64bit, the rewrite started working.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文