Home Ask Login Register

Developers Planet

Your answer is one click away!

user4120936 February 2016

Java app loads single url only after deployed

I have tested my Java app in local developed using jsp and servlets.

I have a domain and I copy the war in this domain. Now I am able to access this app as http://mdomain.com:8080/myApp without issues.

Now, I want to make this app available while hitting http://mdomain.com. So, I configured the .htaccess file for this domain as follows,

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^mydomain.com  
    RewriteRule ^(.*)$ http://mdomain.com:8080/myApp/ [P]

Now, I am able to see the home page when hittng http://mdomain.com.

While I am hitting submit button, the page is loading only the home page and no respective pages displayed.

I am using apache tomcat7. Put my war in webapps.

What I am missing here?

May I copy the myApp folder to public_html folder.


anubhava February 2016

If mod_proxy is enabled then you can use:

RewriteEngine on

RewriteCond %{HTTP_HOST} ^mydomain\.com$ [NC]  
RewriteRule ^(.*)$ http://mdomain.com:8080/myApp/$1 [P]

Note use of $1 which is back-reference of captured value in RewriteRule

Post Status

Asked in February 2016
Viewed 3,136 times
Voted 4
Answered 1 times


Leave an answer

Quote of the day: live life