标签: url-rewrite-module

如何在Server 2012中的IIS 8.5中启用"URL重写"模块?

我有Windows Server 2012,我已经安装了IIS 8.5,但我看不到URL重写模块.我该如何启用或安装?

url-rewrite-module windows-server-2012 iis-8.5

108
推荐指数
4
解决办法
21万
查看次数

Windows 8.1/Windows 10破坏了我的ASP.NET/IIS:"服务不可用"

随着Windows 8.1最终发布到MSDN/Technet,我在使用Win 8.1 RTM进行就地升级后遇到了运行我的ASP.NET应用程序的以下问题:

暂停服务

http错误503服务不可用.

  • AppPool已经死亡并显示出状态 Stopped
  • IIS日志什么都没有
  • Windows应用程序日志中有一条线索,其中包含此错误

    The Module DLL C:\WINDOWS\system32\inetsrv\rewrite.dll failed to load. The data is the error.

如何恢复我的IIS以使其再次工作?

url-rewrite-module windows-8.1

94
推荐指数
4
解决办法
3万
查看次数

在IIS7中将URL从https://重写为http://

我正在尝试从表单中重写网址:

https://example.com/about
Run Code Online (Sandbox Code Playgroud)

到形式

http://example.com/about
Run Code Online (Sandbox Code Playgroud)

使用IIS7 URL重写:

<!-- http:// to https:// rule -->
<rule name="ForceHttpsBilling" stopProcessing="true">
  <match url="(.*)billing/(.*)" ignoreCase="true" />
  <conditions>
    <add input="{HTTPS}" pattern="off" ignoreCase="false" />
  </conditions>
  <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}{REQUEST_URI}" />
</rule>

<!-- https:// to http:// rule -->    
<rule name="ForceNonHttps" stopProcessing="true">
  <match url="(.*)billing/(.*)" ignoreCase="true" negate="true" />
  <conditions>
      <add input="{SERVER_PORT}" pattern="^443$" />
  </conditions>
  <action type="Redirect" redirectType="Found" url="http://{HTTP_HOST}{REQUEST_URI}" />
</rule>
Run Code Online (Sandbox Code Playgroud)

我不知所措; 我一直在浏览网页上的例子,并尝试我能想到的每一种语法.我简单地指定重写规则似乎没有工作,在所有的任何HTTPS请求,就好像所有的https://请求都平了无形的重写引擎.

规则工作正常; 见下面的答案.

https iis-7 url-rewriting url-rewrite-module

37
推荐指数
3
解决办法
6万
查看次数

IIS7 urlrewrite模块 - 外部xml文件中的规则

我正在使用IIS7 UrlRewrite模块.我在web.config <system.webServer><rewrite>部分设置了规则.我想知道是否有一种方法可以在一个外部xml文件而不是web.config文件中定义规则.谢谢.

iis-7 web-config url-rewriting url-rewrite-module

27
推荐指数
2
解决办法
2万
查看次数

IIS URL重写模块:基于QueryString的重定向

我在根据查询字符串参数重定向到另一个URL时遇到一些问题.我想将输入www.domain.com/signup.aspx?p=1的用户重定向到:

www.domain.com/signup

<rule name="Signup Redirect 1" stopProcessing="true">
  <match url="signup\.aspx\?p=1" />
  <conditions logicalGrouping="MatchAll" />
  <action type="Redirect" url="signup" redirectType="Temporary" />
</rule>
Run Code Online (Sandbox Code Playgroud)

现在,当他们进入www.domain.com/signup.aspx?p=2时,他们必须去:

www.domain.com/signup/promocode

<rule name="Signup Redirect 2" stopProcessing="true">
  <match url="signup\.aspx\?p=2" />
  <conditions logicalGrouping="MatchAll" />
  <action type="Redirect" url="signup/promocode" redirectType="Temporary" />
</rule>
Run Code Online (Sandbox Code Playgroud)

以上规则不起作用.这样做的正确方法是什么?提前致谢.

GR

马亭

iis iis-7 url-rewriting url-rewrite-module

26
推荐指数
2
解决办法
3万
查看次数

IIS重写不起作用(但重定向确实)

我正在尝试使用Rewrite Module 2.0进行URL 重写,但我没有运气让它工作.我要做的是将端口80上的所有对Web应用程序的调用重新写入IIS中托管的其他应用程序(或者可能在网络上的不同服务器上).使用IIS提供的GUI我创建了以下规则:

<rewrite>
    <rules>
        <rule name="ReverseProxyInboundRule1" stopProcessing="true">
            <match url="site1/(.*)" />
            <action type="Rewrite" url="http://localhost:7001/{R:1}" />
        </rule>
    </rules>
</rewrite>
Run Code Online (Sandbox Code Playgroud)

安静简单,但不幸的是它不起作用.另一方面,当我将动作类型更改为时Redirect,它可以正常工作.

可能是什么问题呢?

.net asp.net iis url-rewriting url-rewrite-module

20
推荐指数
2
解决办法
2万
查看次数

IIS URL重写:添加除.html和.aspx之外的尾部斜杠

通过IIS URL重写模块向所有URL添加尾部斜杠广泛传播,但如何为以.html和.aspx结尾的URL添加例外

今天我有这个:

<rule name="Add trailing slash" stopProcessing="true">
  <match url="(.*[^/])$" />
  <conditions>
    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    <!-- Doesn't seem to be working -->
    <!--<add input="{REQUEST_URI}" pattern="(.*?).html$" negate="true" />-->
    <!--<add input="{REQUEST_URI}" pattern="(.*?).aspx$" negate="true" />-->
  </conditions>
  <action type="Redirect" redirectType="Permanent" url="{R:1}/" />
</rule>
Run Code Online (Sandbox Code Playgroud)

asp.net iis url-rewriting url-rewrite-module

19
推荐指数
2
解决办法
3万
查看次数

无法使用URL重写出站规则更改IIS响应代码

我正在尝试设置IIS URL重写规则以匹配403响应,因为有人在禁用目录浏览时尝试浏览目录.我想然后将它们重定向到我为404定义的通常的ASP.NET自定义错误页面.

这就是我目前所拥有的:

<outboundRules>
  <!-- By default, browsing a directory with no default resource will return 403 -->
  <rule name="Directory browsing location">
    <match serverVariable="RESPONSE_LOCATION" pattern="(.*)" />
    <conditions>
      <add input="{RESPONSE_STATUS}" pattern="^403" />
    </conditions>
    <action type="Rewrite" value="/Error/PageNotFound?aspxerrorpath={PATH_INFO}"/>
  </rule>
  <rule name="Directory browsing status code" patternSyntax="ExactMatch">
    <match serverVariable="RESPONSE_STATUS" pattern="403" />
    <action type="Rewrite" value="302" />
  </rule>
</outboundRules>
Run Code Online (Sandbox Code Playgroud)

我的假设是它需要是一个出站规则,我需要重写状态代码并添加位置响应头,尽管后者在最初的403响应中不会存在.

目前的行为是......没有.无论我做多少调整,我仍然会看到403s.有什么想法吗?

顺便说一下,不,网站上没有任何合法的403可以被吞下.我还可以为可能导致满足条件的每个路径创建入站规则,但这不是很可扩展.

asp.net iis web-config url-rewriting url-rewrite-module

18
推荐指数
1
解决办法
6894
查看次数

重写规则错误:HTTP错误500.50 - URL重写模块错误.表达式"https://abc.com/{R:1}"无法扩展

每当有人通过HTTP协议发出请求时,我都会重写url以使其成为HTTPS.这是web.config中的代码:

<rule name="Imported Rule 1-1" enabled="true" stopProcessing="true">
    <match url="^(?!https://).*" ignoreCase="false" />
    <conditions logicalGrouping="MatchAll">
        <add input="{SERVER_PORT}" pattern="80" ignoreCase="false" />
    </conditions>
    <action type="Rewrite" url="https://abc.com/{R:1}" />
</rule> 
Run Code Online (Sandbox Code Playgroud)

但是,当我在http://上浏览时,我收到IIS错误

HTTP错误500.50 - URL重写模块错误.表达式"https://abc.com/{R:1}"无法扩展.

我该如何解决这个问题?我完全糊涂了.

asp.net iis iis-7 url-rewriting url-rewrite-module

15
推荐指数
1
解决办法
3万
查看次数

ASP.NET OAuth存在URL重写问题

我的生产设置如下:

  • M1 - ASP.NET网站
  • M2 - IIS URL重写2.0 + ARR 3.0

使用IIS URL Rewrite,对M2的任何请求,例如http:// m2 /app/login.aspx将被重定向到M1,如http:// m1 /app/login.aspx.

在M1上,ASP.NET Open Auth已在网站上实施,以使用Google外部身份验证.当用户点击Google按钮时,浏览器将被重定向到Google登录页面以允许用户进行身份验证.

但是当从M2访问网站时,.net oAuth(https:// accounts.google.com/[query-string])生成的重定向网址将重定向到Google,正在被URL重写替换为http:// m2/[query-string].

所以要清楚; 当通过外部身份验证提供程序进行身份验证请求时,返回302重定向.通常这种形式可能如下所示:

响应标题:

...

位置:https:// accounts.google.com/o/oauth2/auth?big_long_query_string

...

此重定向由位于代理服务器后面的服务器(M1)创建(M2 - IIS URL Rewrite 2.0 + ARR 3.0).因此,重写服务器将Location标头重写为:

响应标题:

...

位置:http:// M1/o/oauth2/auth?big_long_query_string

...

我们需要的是一条规则,它不会在重定向时重写位置URL.它也只能针对某些重定向.大多数情况下,这里提到的行为是必需的,因为所有重定向都被重定向到主代理服务器.有人可以为某些重定向建议解决方案或解决方法吗?

asp.net oauth url-rewrite-module arr

14
推荐指数
1
解决办法
1540
查看次数