【问题标题】:Url Rewrite for angular urls角网址的网址重写
【发布时间】:2016-02-05 00:09:51
【问题描述】:

我有 Angular URL,例如 "www.mycompany.com/employee/{78}" 。 我想重写这个 url,就好像我点击这个员工并尝试在新标签中打开它,它使用基本 url 即“www.mycompany.com/index.html/employee/78”。

 <rule name="main rule 2" stopProcessing="true">
      <match url="^index.html/employee/[0-9]+$" /> 
                    <action type="Redirect" url="/employee/{78}" appendQueryString="true" />
 </rule>

我的问题是如何使用查询字符串?即在这种情况下,重写 URL 时的员工 ID。现在我已经输入了常数 78,但我想引用“[0-9]+$”这个值的任何常数。

【问题讨论】:

    标签: angularjs url-rewriting


    【解决方案1】:

    找到以下答案。需要为 ([0-9]+) 加上括号才能使用 {R:1}。

    <rule name="main rule 2" stopProcessing="true">
       <match url="^index.htm/employee/([0-9]+)" /> 
         <action type="Redirect" url="/employee/{R:1}" appendQueryString="false" />
    </rule>
    

    【讨论】:

      猜你喜欢
      • 2018-07-31
      • 2010-10-08
      • 2017-07-10
      • 1970-01-01
      • 2016-11-03
      • 1970-01-01
      • 2011-03-22
      • 2015-04-12
      相关资源
      最近更新 更多