使用IIS7.5将网站的URL绑定到另一个网站控制器

Pat*_*ick 5 iis asp.net-mvc url-redirection

我有两个MVC网站:

  • www.website1.com/Mobile
  • www.website2.com

我需要创建一个指向www.website1.com/Mobile的URL www.website1.com/mobile,无需任何重定向,我必须留在URL www.website2.com/Mobile并打开www.website1的内容. com/Mobile Controller/View.

JB *_*ing 2

至少有几种方法可以做到这一点:

  1. iFrame。www.website2.com/mobile您可以在该指向下创建一个页面www.website1.com/Mobile,但地址栏将保持不变。W3 Schools有一些基础知识,我也使用它作为在页面概念中生成页面的方法。

  2. 反向代理。Nginx 可以用来将站点www.website2.com/Mobile作为www.website1.com/Mobile一个可用的软件包来访问。Nginx 文档会有更具体的细节,尽管我过去有时使用过它。

以第二个链接为例:

location /some/path/ {
    proxy_pass http://www.example.com/link/;
}
Run Code Online (Sandbox Code Playgroud)

就您而言,您可能想做这样的事情:

location /Mobile {
    proxy_pass http://www.website1.com/Mobile/;
}
Run Code Online (Sandbox Code Playgroud)

当然,必须确保 Nginx 配置正确,因为它会在这里替换您的初始 Web 服务器。这个想法是 Nginx 通过用户从未注意到的代理内容在幕后进行重定向和其他操作。