Reputation:
I'm using Windows Server 2003. I have one web application running on IIS and another web application running on Apache Tomcat. Currently all requests go to port 80
. From what I understand, Tomcat and IIS cannot use the same port simultaneously. Therefore I need a way to redirect users. If a user goes to www.example.com then I need them to use http://localhost:80
but if they go to www.otherExample.com then I need them to use http://localhost:8084/otherExample
How does this generally get done?
Upvotes: 0
Views: 9510
Reputation: 12453
Then you can access example.com and otherExample.com without ports or directory changes.
Upvotes: 0
Reputation: 6120
Well, you should go with something like this:
First of all, I will assume that you know how to map example.com and otherexample.com to 127.0.0.1 and that is really what you want. So I will skip that part and go straight to configuration.
First of all, when users type http://www.domain.com it is EXACTLY THE SAME as typing http://www.domain.com:80. Also, when users type https://www.domain.com it is EXACTLY THE SAME as typing https://www.domain.com:443. That means, if you omit the ports for https and https, 80 and 443 are assumed respectively.
So, this brings you to only one conclusion. You have to set one web server (IIS or Tomcat) to port 80, and another to port 8084. You decide which is which, because for configuration it is irrelevant.
Now, to accomplish what you need, you need to create a redirection script on the server which listens to port 80. So, if you use PHP for redirection script, you could use something like this:
<?php
if ($_SERVER['HTTP_HOST']=='www.otherexample.com') {
Header('Location: http://localhost:8084/otherExample');
}
?>
Also, you could accomplish something similar using configuration file of the server itself (the one that is listening on port 80).
This is only general explanation of the steps you need to take. Obviously, you will need to adapt them to work for your case.
Let me know what you think.
Upvotes: -1