Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bind a URL from a Website to another Website Controller with IIS7.5

I have two MVC websites:

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

I need to create a URL www.website2.com/mobile that points to www.website1.com/Mobile without any redirect, I have to stay in the URL www.website2.com/Mobile and open the content of www.website1.com/Mobile Controller/View.

like image 250
Patrick Avatar asked Oct 19 '22 23:10

Patrick


1 Answers

There are at least a few ways to do this:

  1. iFrame. You could make a page under www.website2.com/mobile that points to www.website1.com/Mobile but the address bar would remain the same. W3 Schools has some basics where I've also used this as a way to generate a page within a page concept.

  2. Reverse Proxy. Nginx could be used to make the site under www.website2.com/Mobile go to www.website1.com/Mobile as one software package that could be used. Nginx documentation would have more specific details though I have used this at times in the past.

From the second link as an example:

location /some/path/ {
    proxy_pass http://www.example.com/link/;
}

In your case, you'd likely want to do something like this:

location /Mobile {
    proxy_pass http://www.website1.com/Mobile/;
}

Course one does have to ensure that Nginx is configured properly as it is kind replacing your initial web server here. The idea would be that Nginx does the redirecting and stuff behind the scenes through its proxying stuff that the user never notices.

like image 127
JB King Avatar answered Nov 11 '22 18:11

JB King