Redirect to another URL based on the URL you entered

Asked

Viewed 200 times

-2

My problem is this,

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

For example on 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 the address does not show the path, only what was originally typed.

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

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

  • Welcome to Sopt! Please consider specifying your question further and be careful when assigning tags to it. Because of the lack of clarity in your doubt, it’s hard for anyone to help you.

  • Hi John, welcome to [en.so]! Please try to provide more details so we can help you better. You talked about the server being IIS and the Java language (tag). Are you sure it is? What technologies do you have on this server?

1 answer

0

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

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

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

Then you can use a function more or less 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);
  • Thanks for your attention, I will be to see if it works, but I solved only with the same frame and without need of java script. <br/> instead of putting the full URL src="http://webmail.velmo.com.br/MEWebmail" replaces with the relative path src=". /Mewebmail" , this solved, since the destination is in the same virtual directory. sorry for the confusion in my original question..

Browser other questions tagged

You are not signed in. Login or sign up in order to post.