Redirect to another URL based on the typed URL

-2

My problem is as follows,

I want to add / email the url that was typed into the browser and redirect to this new url. I am using IIS from windows server 2012. The site accepts more than one host.

For example in the same site I accept the host webmail.joao.com.br, webmail.kaina.com.br, webmail.vicor.com.br.

I wanted this redirection to be done by adding "/ emailx" to the host that was typed and that the address does not show the path, just what was typed originally.

Currently I use the following code, but can only redirect to a single URL:

  

<frame src="http://webmail.velmo.com.br/MEWebmail"frameborder="0" scrolling="no">

    
asked by anonymous 14.03.2016 / 23:34

1 answer

0

One way to show another page within the same domain in a frame is to change the address dynamically via JavaScript:

First, set a blank address and a id in frame :

<frame id="webmail" src="#" frameborder="0" scrolling="no">

Next, you can use a more or less function like the following to modify the URL and change the src of frame :

function defineFrameUrl(originalUrl) {
  var frame = document.getElementById('webmail');
  if (frame) frame.src = originalUrl + "/emailx";
}

And finally, you call the function by passing the current address:

defineFrameUrl(window.location.href);
    
15.03.2016 / 05:14