单一 Web 应用程序下的多个国家/语言站点 - TLD 路由重写
我想在同一个 Web 应用程序中托管多个顶级域 (TLD)。
场景:www.mywebsite.com 有 /en-us/、/en-gb/、/fr-ca/、/ja/ 等语言子文件夹... 因此 www.mywebsite.com/en-gb/ 将是该网站的英国版本。
英国用户应该访问 www.mywebsite.co.uk,但会被路由到 www.mywebsite.com/en-gb/
在 IIS 中,我已设置此 Web 应用程序的绑定来处理 www.mywebsite.com 和 www。 mywebsite.co.uk 域名。
URL 重写 2.0 模块已添加到 IIS 中,并包含以下规则:
<rewrite>
<rules>
<rule name="CanonicalHostNameRule" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www\.mywebsite\.co\.uk$" />
</conditions>
<action type="Rewrite" url="http://www.mywebsite.com/en-gb/{R:1}" />
</rule>
</rules>
</rewrite>
访问 www.mywebsite.co.uk 的用户将 URL 重写为 www.mywebsite.com/en-gb/,但是,我希望 URL 保留为 www .mywebsite.co.uk 对于他们来说,事实上,我希望将 www.mywebsite.com/en-gb/ 重写为 www.mywebsite.co.uk 以保持一致性。
我仍然不太确定我想做的事情的正确术语是什么。到目前为止,我已经遇到过“多租户”、“应用程序请求路由”、“URL 路由”、“URL 重写”以及其他一些内容。
以下是我一直在阅读的一些资源,以尝试找出最好的处理方法。我走在正确的轨道上吗?我还没有找到一个很好的例子来演示如何使用 TLD 来实现这一点。
I want to host multiple Top Level Domains (TLDs) off of the same web application.
Scenario: www.mywebsite.com has language sub-folders of /en-us/, /en-gb/, /fr-ca/, /ja/, etc...
So www.mywebsite.com/en-gb/ would be the UK version of the site.
UK users should go to www.mywebsite.co.uk but be routed to www.mywebsite.com/en-gb/
In IIS, I've set the bindings for this web application to handle both www.mywebsite.com and www.mywebsite.co.uk domains.
The URL Rewrite 2.0 module is added to IIS and includes this rule:
<rewrite>
<rules>
<rule name="CanonicalHostNameRule" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www\.mywebsite\.co\.uk$" />
</conditions>
<action type="Rewrite" url="http://www.mywebsite.com/en-gb/{R:1}" />
</rule>
</rules>
</rewrite>
Users who go to www.mywebsite.co.uk have the URL rewritten to www.mywebsite.com/en-gb/, however, I want the URL to remain www.mywebsite.co.uk for them, and in fact, I would want the www.mywebsite.com/en-gb/ to be rewritten to www.mywebsite.co.uk for consistency.
I'm still not even quite sure what the proper terminology is for what I want to do. So far I've run across 'multi-tenancy', 'application request routing', 'URL routing', 'URL rewriting', and a few others.
Here are a few resources I've been reading to try and figure out how best to handle this. Am I on the right track? I haven't found a good example that demonstrates doing this with TLD's.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论