3

My website has implemented by using JAVA. So we have taken VPS and installed Tomcat then deployed My website is appearing like this

whenever I click www.mysite.com in url ... it is appearing as below.

http://mysite.com:8080/foldername/

But I would like to see my website as www.mysite.com

Can any one suggest me what to do .. should I do any changes in htaccess file ?

Christopher Schultz
  • 20,221
  • 9
  • 60
  • 77
user2793170
  • 39
  • 1
  • 1
  • 6
  • 4
    You can't do this without a proxy/server on 80 (for HTTP) or 443 (or HTTPS) as those are the default port numbers. In all cases where the domain is specified and the default port is *not* used, it must be supplied as part of the URL. However, you can use `//server/relative/urls` which will use the same protocol/host/port as the current HTML page. – user2246674 Oct 04 '13 at 19:27
  • See http://stackoverflow.com/questions/4756039/how-to-change-the-port-of-tomcat-from-8080-to-80 – David Levesque Oct 05 '13 at 01:42
  • 1
    I voted to close this question because it is not a programming question and it is off-topic on Stack Overflow. Non-programming questions about your website should be asked on [webmasters.se]. In this case the question has already been asked and answered there: [How to remove port number from the URL?](https://webmasters.stackexchange.com/questions/118440/how-to-remove-port-number-from-the-url) – Stephen Ostermiller Mar 03 '22 at 16:07

3 Answers3

6

If you don't provide the port number in the URL your HTTP requests would be sent to port 80. You can set up a firewall rule to redirect requests headed towards port 80 to 8080.

The Governor
  • 1,152
  • 1
  • 12
  • 28
  • I would like to hide port number.. it should not appear to customers... To achieve that.. we files I have to change.. – user2793170 Oct 04 '13 at 20:29
  • Since you are using centos 6.3 just enable the firewall and add a rule to forward requests from port 80 to 8080. I have already answered this question here http://stackoverflow.com/questions/17504794/is-sudo-ing-tomcats-startup-with-a-non-root-user-the-same-as-running-it-as-root/17505346#17505346 – The Governor Oct 08 '13 at 16:14
5

If you don't want a port number in your URL, you have to use the default port number for HTTP, which is 80. If it's anything other than 80, you will be required to put the port number in the URL. That's all there is to it.

Now, if your question is "how do I host my Tomcat website on port 80", well there are plenty of answers to that question both on SA and teh intertubes. Just search.

Christopher Schultz
  • 20,221
  • 9
  • 60
  • 77
0

If you wish to redirect all request on tomcat on default port you have to stop the IIS and use port 80 for your tomcat application or make the changes in IIS to redirect it.

4b0
  • 21,981
  • 30
  • 95
  • 142