简体   繁体   English

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

[英]Setting up URL Rewrite rule for a specific domain SEO

On Google there is the following Url 在Google上有以下网址

www.domain.ch/House/rent www.domain.ch/House/rent

So now my page is now available in multi language and i have now the language in the url, and it looks like this 所以现在我的页面现在可以使用多种语言了,而且我现在在网址中有了该语言,看起来像这样

www.domain.ch/en/house/rent www.domain.ch/en/house/rent

So I will redirect all old links with url rewrite in the web.config, but I can't find out the match condition to find out if there is a languege insite the url. 因此,我将使用web.config中的url重写来重定向所有旧链接,但是我无法找到匹配条件来确定网址中是否有语言。

My role: 我的角色:

<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>

Thanks for any help! 谢谢你的帮助!

<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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM