为特定域 SEO 设置 URL 重写规则

Setting up URL Rewrite rule for a specific domain SEO

在 Google 上有以下 Url

www.domain.ch/House/rent

所以现在我的页面现在可以使用多语言了,我现在有 url 中的语言,它看起来像这样

www.domain.ch/en/house/rent

所以我将重定向所有旧链接 url 在 web.config 中重写,但我无法找到匹配条件来确定 [=33] 中是否有语言=].

我的角色:

<rule name="mydomain.com" >
  <match url="(.*)" />
  <conditions logicalGrouping="MatchAll">
    <add input="{HTTP_HOST}" pattern="^(localhost:3005/|localhost:3005/)$" />
  </conditions>
 <action type="Redirect" url="http://localhost:3005/de/{R:1}" logRewrittenUrl="true" />
</rule>

感谢您的帮助!

<rule name="mydomain.com" stopProcessing="true" >
  <match url="(.*)" />
  <conditions>
    <!-- redirect only if the URL doesn't contain /en/ or /de/ already (negate = true)-->
    <add input="{URL}" pattern="/en/|/de/" negate="true" />
  </conditions>
  <action type="Redirect" url="de/{R:1}"  />
</rule>