标签: url-rewrite-module

IIS 7 URL重写导致Google AdWords/Google Analytics跟踪问题

我们最近在我们的网站上实施了IIS7 URL重写,以获得更好看的URL.

然而,在我们实施它的那一天,在Google Analytics中,我们的付费与自然搜索结果完全搞砸了.突然间,它将付费点击(AdWords)视为有机点击.它在AdWords中显示正确(每天支付约200 +点击费用),但在Google Analytics中只有~10个付费节目,但我们的有机帐户显示缺少付费点击.

我想知道我的网址重写是否会阻止Google Analytics跟踪付费的AdWords点击?

以下是我们在Google上展示的广告链接示例:

http://www.google.com/aclk?sa=l&ai=C03Wve-ZTTt7QC-i8sQK5iIGXA-7_wYMCvpDoqxu54dM0CAAQASgDUMGQrLb7_____wFgydaQjNCklBCgAcfhhv8DyAEBqgQbT9Daa567OsJBGZL_14L3WbAhEpxL9j8g6o7&sig=AOD64_0JL2LlkX_ZN_YDHqOFFlAhTrIb7A&ved=0CAgQ0Qw&adurl=http://www.ourdomain.com
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,广告指向http://www.ourdomain.com(示例) - 根目录.这是Default.aspx,它在页面加载事件后面的代码中有一个重定向,重定向到Home.aspx(http://www.ourdomain.com/home.aspx) - 没有进行URL重写.这个特定的重定向已经存在,因为BEFORE URL重写已经实现并且跟踪引用很好UNTIL我添加了IIS 7 URL重写.

我只有2条重写规则可能会影响Google AdWords链接(见下文).

<!-- Remove any trailing slashes -->
<rule name="Remove trailing slash" stopProcessing="true">
<match url="(.*)/$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="{R:1}" />
</rule>

<!-- Homepage Rewrite -->
<rule name="Homepage">
<match url="^Home$" />
<action type="Rewrite" url="/home.aspx" />
</rule>
Run Code Online (Sandbox Code Playgroud)

我不明白为什么其中任何一个会导致问题,因为我们的AdWords广告的网址再次指向根目录 - http://www.ourdomain.com(没有尾随斜杠,没有/ home).

关于我可能检查的任何其他想法?非常感谢!

asp.net iis-7 google-analytics google-adwords url-rewrite-module

5
推荐指数
1
解决办法
2043
查看次数

url使用visual studio 2012重写

我正在尝试在VS 2012上使用带有MVC应用程序的url重写模块.我已经使用web平台4.0安装了模块,遵循Ruslan的博客文章,根据评论更新了他的js脚本(特别是Brant Burnett的最后一个) 10月19日,脚本执行成功.我检查了DotNetConfig.xsd,一切看起来都很好.

如果我打开IIS管理控制台,我会看到Url Rewrite模块,一切正常.

我创建一个简单的MVC解决方案(使用默认的主/帐户控制),当我添加了简单的ToLowerCase规则(也鲁斯兰的博客复制),我得到的标签和HTTP 500.19下的蓝色波浪线,如果我尝试执行.重启等等没有帮助.另外重要提一下我使用的是IIS Express 7.5.

在运行VS 2010的机器上,同样的程序对我很有用,url重写工作没有问题.

谁知道什么可能出错?进一步分析需要哪些信息?为什么intellisense工作和重写模块不被认可?

url-rewrite-module visual-studio-2012

5
推荐指数
1
解决办法
3357
查看次数

IIS重写模块和子应用程序

这是我部署的内容:

IIS部署

testRedirect是一个空的网站.所有子应用程序都是已在应用程序中转换的子文件夹.所有这些都是ASP .Net MVC网站.

这是我想要设置的内容:

  • Http://localhost/必须显示内容SiteName1而不Http://localhost/SiteName1/在地址栏中显示(必须保留Http://localhost/)

  • Http://localhost/SiteName1/必须显示内容SiteName1 而不Http://localhost/SiteName1/在地址栏中显示(必须保留Http://localhost/)

  • Http://localhost/SiteName2/显示地址栏中的内容SiteName2和显示Http://localhost/SiteName2/(SiteName3和&SiteName4和任何其他网站的相同行为......)

换句话说,我希望我SiteName1的行为像一个家庭网站

到目前为止我尝试过的是类似@cheesemacfly 在这里提供的答案:

<rules>
    <rule name="Redirect if SiteName1" stopProcessing="true">
        <match url="^SiteName1/(.*)$" />
        <action type="Redirect" url="{R:1}" />
    </rule>
    <rule name="Rewrite to sub folder">
        <match url="^.*$" />
        <action type="Rewrite" url="SiteName1/{R:0}" />
    </rule>
</rules>
Run Code Online (Sandbox Code Playgroud)

它适用于Case1和2,但不适用于其他.

我试图添加像这样的规则,但它没有成功......

<rule name="if_not_SiteName1" stopProcessing="true">
   <match url="^SiteName1/(.*)$" negate="true" />
   <action type="None" /> …
Run Code Online (Sandbox Code Playgroud)

iis url rewrite url-rewriting url-rewrite-module

5
推荐指数
1
解决办法
3809
查看次数

包含百分号(%)的IIS反向代理重新编码URL

我正在尝试使用IIS 7.5,应用程序请求路由 3.0(ARR)和URL重写 2.0 为Jenkins设置反向代理。

我的代理服务器大多数都在工作,但是遇到包含百分号(%)的URL的问题。

无论我如何尝试,代理都坚持对重写的URL中的百分号进行解码或重新编码。

这就是我想要重写URL的方式:

http://my.proxy/a%2Fb -> http://my.host:8080/a%2Fb
Run Code Online (Sandbox Code Playgroud)

这是实际重写URL的方式:

http://my.proxy/a%2Fb -> http://my.host:8080/a/b
- or -
http://my.proxy/a%2Fb -> http://my.host:8080/a%252Fb
Run Code Online (Sandbox Code Playgroud)

如何获得IIS \ ARR \ Rewrite来停止对重写的URL进行重新编码?

我尝试过的事情:

  1. 普通的反向代理(将URL重写为http://my.host:8080/a/b):

    <rule name="ReverseProxyInboundRule1" stopProcessing="true"> <match url="(.*)" ignoreCase="true" /> <action type="Rewrite" url="http://my.host:8080/{R:1}" /> </rule>

  2. 使用UNENCODED_URL服务器变量(将URL重写为http://my.host:8080/a%252Fb):

    <rule name="ReverseProxyInboundRule1" stopProcessing="true"> <match url="(.*)" ignoreCase="false" /> <conditions logicalGrouping="MatchAll"> <add input="{UNENCODED_URL}" pattern="/(.*)" /> </conditions> <action type="Rewrite" url="http://my.host:8080/{C:1}" /> </rule>

  3. 只需直接输入网址(作为测试-还将网址重写为http://my.host:8080/a%252Fb):

    <rule name="ReverseProxyInboundRule1" stopProcessing="true"> <match url="(.*)" …

iis reverse-proxy urlencode url-rewrite-module arr

5
推荐指数
1
解决办法
1944
查看次数

使用ARR和URL重写从IIS转发NTLM凭据

在此先感谢您的帮助。

在我的环境中,我将IIS配置为充当反向代理,并将请求转发到某些路径到另一台主机上的应用程序服务器。为此,我使用了应用程序请求路由(ARR)和URL重写模块,创建了规则,并且一切正常。

IIS负责使用NTLM对客户端进行身份验证,因此我的问题是:在对用户进行身份验证之后,是否可以将身份验证凭据(至少是用户名)传递给我的应用程序服务器?

我试图这样做,将自定义标头添加到请求中,编写了如下规则:

<rule name="ForwardToApplicationServer">
<match url=".*" />
<serverVariables>
<set name="HTTP_AUTH_USER" value="{AUTH_USER}" />
</serverVariables>
<action type="Rewrite" url="http://myappserver/myapp/{R:0}" logRewrittenUrl="true" />
</rule>
Run Code Online (Sandbox Code Playgroud)

但这是行不通的:当我在应用程序上读取它时,标题总是空的。我也尝试过,但是这些都不起作用。

那么,我在做什么错呢?我应该使用另一个服务器变量吗?我想念什么吗?

一般而言:可以做我想做的事吗?

再次感谢您的帮助,如果我提出的要求很明显,但是我对使用IIS还是陌生的,并且找不到任何有用的信息,请原谅我。

iis ntlm windows-authentication url-rewrite-module arr

5
推荐指数
1
解决办法
4013
查看次数

如何在iisnode中托管服务和静态内容

我的网站在快递中工作.但现在我需要在IIS上托管它.如何让我的路由与IISNode一起使用?

我能够将我的静态内容移动到/ public文件夹(html,前端js等).我不想这样做,但让那部分工作.

我将服务器端逻辑移到了/ server.

我以前有.Net Web API样式路由工作,我的服务托管在/ api.我将这些移动到/ server/api.

每当我尝试请求我的API时,我都会获得404.如何使用IISNode?

app.use("/api", require("./api"));

// routes/api/index.js
var router = require('express').Router();
router.use('/questionsets', require('./questionsets'));
module.exports = router;   

var router = require('express').Router();
router.use('/questionsets', require('./questionsets.js'));
module.exports = router;

// routes/api/questions.js
var router = require('express').Router();

router.get('/', function (req, res) {
    ...
});

router.get('/:id', function (req, res) {
    ...
});

module.exports = router;        


<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <security>
      <requestFiltering>
        <hiddenSegments>
          <remove segment="bin" />
        </hiddenSegments>
      </requestFiltering>
    </security>
    <handlers>
      <add name="iisnode" path="bin/www" verb="*" modules="iisnode" />
    </handlers>
    <iisnode loggingEnabled="false" …
Run Code Online (Sandbox Code Playgroud)

iis node.js express iisnode url-rewrite-module

5
推荐指数
1
解决办法
413
查看次数

IIS 7.5 URL重写规则,用于根据用户代理处理请求

我已经编写了一条规则来根据用户代理重定向请求.

该规则设置为将默认请求(非移动)重定向Domain1到移动域和移动域的请求Domain2.

目前,即使在应用移动重定向后,所有来自移动设备的请求都将被用于Domain1 查找下面的重定向规则.谁能告诉我我错过了什么?

<rewrite>
    <rules>
        <rule name="Mobile UA redirect" enabled="true" stopProcessing="true">
            <match url="(.*)" />
            <conditions>
                <add input="{HTTP_USER_AGENT}" pattern="^.*BlackBerry.*$ " />
                <add input="{HTTP_USER_AGENT}" pattern=".*Mobile.*Safari" />
            </conditions>
            <action type="Redirect" url="MobileURL" />
        </rule>
        <rule name="Claritinchallenge to" enabled="true" stopProcessing="true">
            <match url="(.*)" />
            <action type="Redirect" url="Second Domain" appendQueryString="false" />
            <conditions>
            </conditions>
        </rule>
    </rules>
</rewrite>
Run Code Online (Sandbox Code Playgroud)

iis url-rewriting url-rewrite-module

4
推荐指数
1
解决办法
7568
查看次数

使用请求标头的 IIS URL 重写规则

我一直在尝试创建一个 IIS 重写规则,该规则查看 API 的传入标头,如果它包含某个字符串,则将它们重定向到某个页面而不是 API(Noobs - 使用文档 API 密钥)

搞了2个小时了,还是没能解决。有人可以帮忙吗?

谢谢

iis url-rewrite-module

4
推荐指数
1
解决办法
2370
查看次数

IIS10 URL Rewrite 2.1 双重编码问题

我有一个带有ARR 3.0 和 URL 重写模块 2.1 的IIS10 服务器,它充当其他几个 Web 服务器的反向代理。其他服务器在不同的端口上运行,因此 IIS10 服务器在端口 80 上提供“友好 URL”。 URL 重写用于将请求传递给后端服务器。

Jenkins就是这样的服务器之一。

Jenkins 有一条警告消息,告诉您反向代理是否配置良好(更多详细信息请参见此处),并且此警告消息帮助我找到了反向代理中的问题。

问题是 URL 重写正在对我的 URL 进行解码和编码,当它们到达 Jenkins 时,它们与浏览器请求的不同。

例子:

URL重写规则:

<rule name="Jenkins Rewrite" stopProcessing="true">
   <match url="(.*)" />
   <conditions>
     <add input="{HTTP_HOST}" pattern=".*jenkins.mydomain.*" />
     <add input="{HTTPS}" pattern="on" />
   </conditions>
   <action type="Rewrite" url="http://localhost:8080/{R:1}" appendQueryString="true" />
   <serverVariables>
     <set name="HTTP_X_FORWARDED_HOST" value="{HTTP_HOST}" />
     <set name="HTTP_X_FORWARDED_SCHEMA" value="https" />
     <set name="HTTP_X_FORWARDED_PROTO" value="https" />
   </serverVariables>
 </rule>
Run Code Online (Sandbox Code Playgroud)

发送以下 URL 时:

https://jenkins.mydomain/administrativeMonitor/hudson.diagnosis.ReverseProxySetupMonitor/testForReverseProxySetup/https%3A%2F%2Fjenkins.mydomain%2Fmanage%3F

我注意到编码字符在触发规则之前被解码,使得 {R:1} 看起来像这样: /administrativeMonitor/hudson.diagnosis.ReverseProxySetupMonitor/testForReverseProxySetup/https:/jenkins.mydomain/manage/

经过一番研究,我发现我可以使用 …

iis reverse-proxy url-rewriting url-rewrite-module iis-10

4
推荐指数
1
解决办法
5368
查看次数

我们真的需要 URL 重写模块来在 IIS 上托管 Angular 应用程序吗?

对于我们来说,Angular 应用程序无需在 IIS 上安装 URL 重写模块即可运行。我们是否需要 URL 重写模块来在 IIS 上托管 Angular 应用程序?如果我们不安装它会有什么区别?

它适用于下面的 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="/SCOAP/index.html" />
      </rule>
    </rules>
  </rewrite> -->
  <defaultDocument enabled="true">
         <files>
            <add value="index.html" />
         </files>
  </defaultDocument>
</system.webServer>

</configuration>
Run Code Online (Sandbox Code Playgroud)

url-rewrite-module iis-8 angular

4
推荐指数
1
解决办法
5295
查看次数