URL 为 MVC 5 中的默认语言重写多语言站点

URL Rewrite multilingual site for default language in MVC 5

我在 MVC 5 中有一个多语言站点。我已经使用属性路由实现了 SEO 友好 URL。 这是示例 URL:

http://mycompany.com/en
http://mycompany.com/en/about_us
http://mycompany.com/en/product/type/item

http://mycompany.com/fr
http://mycompany.com/fr/about_us
http://mycompany.com/fr/product/type/item

现在,我需要删除默认语言英语的语言代码 (en)。

如何使用 IIS URL 重写工具来实现? 任何替代解决方案也可以。

你可以试试这条规则。当用户输入 url 时,将无语言重定向到 URL 并在浏览器中显示。

<rule name="rule2" enabled="true" stopProcessing="true">
                <match url="en(.*)" />
                <action type="Redirect" url="{R:1}" />
</rule>