【问题标题】:Url Re-write for old urls is not working旧网址的网址重写不起作用
【发布时间】:2017-07-10 14:33:20
【问题描述】:

我正在尝试将我的旧网址重定向到一些现有用户的一些新网址。 这是我的来源网址:

www.example.com/candidate/details/test-name/123

http://www.example.com/jobs/details/test-name/123

我已尝试在 web.config 文件中编写重写 url,如下所示:

  <rule name="Old Url Rewrite" stopProcessing="true">
      <match url="^/candidate/details/.*" />
      <conditions logicalGrouping="MatchAll">
           <add input="{REQUEST_URI}" ignoreCase="true" negate="true" />
      </conditions>
      <action type="Rewrite" url="{REQUEST_URI}/jobs/details/{R:1}" />
    </rule>
  </rules>

我不太了解 url-rewrit 功能。我关注了 SOF 上的一些可用帖子,但无法正确解释它们。任何有关此问题的帮助将不胜感激。

谢谢 马诺吉

【问题讨论】:

    标签: c# url-rewriting web-config url-redirection http-redirect


    【解决方案1】:

    这条规则对你有用:

    <rule name="Old Url Rewrite" stopProcessing="true">
        <match url="^candidate/details/(.*)" />
        <action type="Redirect" url="/jobs/details/{R:1}" />
    </rule>
    

    【讨论】:

    • 感谢您的回复@Victor。我发布这个问题已经很长时间了。我当时找到了解决方案,但错过了在 SOF 上写下答案。我不知道您的答案是否解决了问题,但由于我已经有了答案,因此接受您的答案是正确的。无论如何,谢谢。
    猜你喜欢
    • 1970-01-01
    • 2014-11-15
    • 2016-11-03
    • 1970-01-01
    • 2013-09-22
    • 2015-09-10
    • 1970-01-01
    • 2016-11-22
    相关资源
    最近更新 更多