tomcat servlet being the 'directoryindex' file

bking

Well-Known Member
Mar 1, 2004
206
1
168
Sydney
I have a client who wishes to have his servlets served as if they were part of the apache DirectoryIndex directove.

For example, they have a servlet called Main.do they want to enter http://www.domain.com/ and have this servlet show up.

as Main.do is a servlet and NOT a file as such, there is no such file called Main.do on the filesystem. So apache does not show this file.

Currently we have an index file with a meta refresh tag to redirect to /Main.do
Apache has JkMount /*.do ajp13 in its config file, so when the refresh occurs, it quite cheerfully sends the request of to tomcat and the website is displayed fine.

basicallty we want the Main.do file to be displayed without explicitly writing it in teh URL, much the same as a normal DirectoryIndex occurs.

Is this a possibility with the way Tomcat is configured in cpanel?
(Hope I have not confused...)
 

casey

Well-Known Member
Jan 17, 2003
2,288
0
191
It doesn't work with the DirectoryIndex directive in an .htaccess file?
 

bking

Well-Known Member
Mar 1, 2004
206
1
168
Sydney
Nah.. Because DirectoryIndex expects a file with the name Main.do to exist. But as it is a servlet, there is really no such filename on the server anywhere...
apache just see's the *.do and passes it back to comcat to deal with..
 

casey

Well-Known Member
Jan 17, 2003
2,288
0
191
Ah. I see.
I looked at one of my clients' pages and he was doing a redirect, too.
I don't know the details of how to use tomcat, but a .do index should be doable. Maybe with the welcome-page directive in web.xml?
 

bking

Well-Known Member
Mar 1, 2004
206
1
168
Sydney
Have not used the jsp forward etc.. he wants to get away from the whole redirect/forward thing because he feels that search engines are not rating his site enough due to the redirects/forwards.

As for the URL you sent, I have pointed him to it.. Will see what comes of it.

This issue is all about making the site more 'search engine friendly' as apparently sites with redirects do not rank as high as others...and his site has all been coded around the servlet stuff.

Thanks for your suggestions though! Much appreciated. Will see how we go :)