Url使用2种不同的url绑定重写

时间:2016-01-08 10:38:12

标签: .net url iis url-rewriting rewrite

我在IIS中设置了一个站点,该站点绑定到2个不同的URL,需要不同的语言。我想要做的是当用户登陆myurl1.com时我想重定向到myurl1.com/en-US,当用户登陆myurl2.com时我想重定向到myurl2.com/es-ES.

这是我的尝试,但目前无效:

SELECT distinct t.*, round(SUM(percentage)OVER (order by agentname rows between unbounded preceding and current row),3) AS cumulative
FROM (
  SELECT 
    a.*,
    COUNT(*) AS frequency,
   round(COUNT(*) * 100.00 / SUM(COUNT(*)) OVER (),4) AS percentage
  FROM 
      (select agentname,inputdate, unnest(array[ WSalamPembuka,WKonfirmasiNamaCust, WVerifikasiData,WKemampuanBertanya,WProductKnowledge,WSolusi,WAlternativeSolusi,WSistemPelaporan,WEmpati,WResponsif,WRamahSopan,WPercayaDiri,WHoldCall,WOfferHelp,WPenutup]) as weakness                        
                from call )as a 
                  WHERE a.agentname like '%wendra%' and a.weakness is not null and a.weakness !='' and a.inputdate between '01/12/2015' and  '08/01/2016'
                  group by a.agentname,a.weakness/*,a.inputdate*/
                  order by frequency desc
                ) AS t
                ORDER BY frequency DESC             

我不熟悉url重写语法,所以非常感谢任何帮助!

2 个答案:

答案 0 :(得分:0)

HTTP_HOST 服务器变量不会返回 http https

等协议

请从操作节点的 url 属性中删除 http:// 。这应该工作

试试这个,

<rewrite>
        <rules>
            <rule name="Redirect to en-US locale" stopProcessing="true">
                <match url="^myurl1.com$" />
                <action type="Redirect" url="myurl1.com/en-US" />
                <conditions>
                    <add input="{HTTP_HOST}" pattern="^myurl1.com$" />
                </conditions>
            </rule>
    <rule name="Redirect to es-ES locale" stopProcessing="true">
                <match url="^myurl2.com$" />
                <action type="Redirect" url="myurl2.com/es-ES" />
                <conditions>
                    <add input="{HTTP_HOST}" pattern="^myurl2.com$" />
                </conditions>
            </rule>
        </rules>
    </rewrite>

可在http://www.iis.net/learn/extensions/url-rewrite-module/url-rewrite-module-configuration-reference

找到更多信息

答案 1 :(得分:0)

请看这里你的样本不是urlrewrite它只是一个重定向,我认为这可能对你有所帮助: Setting up redirect in web.config file