Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have deployed a tomcat application and made the necessary configurations to web a server (for eliminating port etc.).

I can access the application following way

http://www.domain.com/appname/

But I would like to access the app even when user enters

http://www.domain.com (just url, no app name)
http://domain.com (just domian name)

I am new to Apache configurations, any pointers, or samples would greatly help.

I thought "proxy pass" would resolve...
Do I need to look for rewriting rules or any other?

share|improve this question

4 Answers 4

I have solved this by putting an index.html file into the webapps/ROOT folder containing a normal HTML redirection:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
    <title>appname</title>
    <meta http-equiv="REFRESH" content="0;url=./appname/"></HEAD>
<body>
</body>
</html>
share|improve this answer

You could deploy your application as the ROOT webapp in Tomcat in order to eliminate the prefix you still have. Just unzip your app to the $CATALINA_HOME/webapps/ROOT folder or - if deployed as zipped .war file - just rename your file to ROOT.war when putting it into the webapps folder. It will then be available without application prefix.

Regarding your domain names with / without "www" part: If you are using Apache in front of Tomcat, then the mod_rewrite reference documentation has a good section describing canonical hostnames.

share|improve this answer
    
thank you, I was able to solve with mod_rewrite –  user79333 Apr 29 '11 at 4:55

For those who may need solution, I just added the following to httpd.conf and it is working fine for my issues:

RewriteEngine on  
RewriteCond %{HTTP_HOST} !^www\. [NC]  
RewriteCond %{HTTP_HOST} !^$  
RewriteRule ^/?(.*) http://www.%[HTTP_HOST}/$1 [L,R,NE]  

ProxyPass         /appname  http://localhost:8080/appname  
ProxyPassReverse  /recsconnect  http:...  
ProxyPass / http...  
ProxyPassReverse / http....  

I forgot earlier adding last two lines.

share|improve this answer

Another option worth considering, is the UrlRewriteFilter. Especially useful if you already know mod_rewrite but don't want to use apache.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.