Iis 如何使用动态源URL重定向到此URL?
我想将所有404流量重定向到root(这已经完成),并添加一个get参数Iis 如何使用动态源URL重定向到此URL?,iis,Iis,我想将所有404流量重定向到root(这已经完成),并添加一个get参数?utm_source=sourceurl.com,其中sourceurl.com将是用户访问的原始URL 如何使用最新版本的IIS实现这一点 更新 我已经在我的web.config中配置了: <?xml version="1.0" encoding="utf-8"?> <configuration> <system.webServer> &l
?utm_source=sourceurl.com
,其中sourceurl.com将是用户访问的原始URL
如何使用最新版本的IIS实现这一点
更新
我已经在我的web.config中配置了:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Angular Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="./index.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
我需要将此旧规则与新规则相结合。更新的规则:
<rule name="AngularJS Routes1" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Redirect" url="http://www.sample.com/index.html?test={R:1}" appendQueryString="false" logRewrittenUrl="true" />
</rule>
以下是失败的请求跟踪结果:
我应该把这个XML放在哪里?刚刚进入输入字段?@Munchkin您必须使用IIS URL重写规则扩展。我不能只将粘贴复制到我的Angular项目的web.config中吗?我很确定我已经安装了重写模块。我更新了问题以包含已配置的配置。如果我在之后添加规则,无论我尝试去哪里,它都会抛出500个错误。。。