So, I am developing a system in java, the server is tomcat, I packed the java code and the static content (.html, .css, .js) inside the same .war, everything is working 100%, so I can access the system this way:
http://ip:port/domain-tomcat
I also created a domain, let's call it www.example.com, in this service I have the apache server running, apache will actually work as a redirect to my tomcat address, I will not put any static content in his public_html folder, so when I type www.example.com it is redirected to http://ip:port/domain-tomcat
I made the following configuration for this redirect:
I created an .htaccess file that looked like this:
RewriteEngine on
RewriteCond% {HTTP_HOST} ^example.com [NC,OR]
RewriteCond% {HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ Http://ip:port/domain-tomcat$1 [L,R=301,NC]
It is working, the problem is that when the redirect to the tomcat address occurs the tomcat address appears in the url, that is, I type www.example.com and the redirect appears http://ip:port/domain-tomcat
Is there any way to redirect from www.example.com to http://ip:port/domain-tomcat and always keep the address www.example.com?
As I browse the site I would just like the http://ip:port/domain-tomcat not to appear... I wish that when browsing the site it would be www.example.com/page1, www.example.com/page2, there is any way to do that?