Link the URL from the website to another website controller using 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 redirects . I need to stay at the URL www.website2.com/Mobile and open the contents of the website www.website1.com/Mobile Controller / View.

+5
source share
3 answers

There are at least a few ways to do this:

  • floating frame

    . You can make a page under www.website2.com/mobile , which points to www.website1.com/Mobile , but the address bar will remain the same. W3 Schools contains some basics in which I also used this as a way to create a page as part of the page concept.

  • Reverse proxy. Nginx can 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. The Nginx documentation will have more specific details, although I have used this sometimes in the past.

From the second link as an example:

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

In your case, you probably want to do something like this:

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

Of course, you need to make sure that Nginx is configured correctly, as it replaces your original web server. The idea was that Nginx does redirection and stuff behind the scenes through its proxies, which the user never notices.

+2
source

You can simply use the iframe inside the website www.website2.com/Mobile, as shown below, to get content from another domain without redirecting:

 <iframe src="http://website1.com/Mobile" width = "100%" height="1000" frameBorder="0"></iframe> 

I urge you to return PartialView for the website www.website1.com/Mobile in order to have a more stylish page on the website2.

+1
source

Using HTML5, you can use the "object":

  <div id="MainPage" > <object type="text/html" data="second site URL" style="width: 100%; height: 128px;"> </object> </div> 
0
source

Source: https://habr.com/ru/post/1235158/


All Articles