Advertisement

03.19.2007 at 09:40PM PDT, ID: 22459713
[x]
Attachment Details

Tomcat / mod_rewrite Conflicts with extensionless requests

Asked by soapergem in Web Servers, Apache Web Server, Apache Tomcat Application Server

Tags: tomcat, extensionless, mod_rewrite

I have been having too many fruitless conversations with support representatives lately, so I figured maybe I'd have a better chance getting an answer here. This is a complicated problem though; I didn't just set it at 500 points for no good reason (which I sometimes do).

One of my websites is hosted by GoDaddy.com, using their "Deluxe Linux Plan":
https://www.godaddy.com/gdshop/hosting/shared.asp?app%5Fhdr=&ci=5652#tabs

I created my whole website in PHP and had it running just fine. I even used some mod_rewrite rules so that certain files could be called without a file extension. For instance, this one:

    RewriteRule ^search$ search.php [NC,L]

You probably all know how that works already, if someone asks for mydomain.com/search it will load up search.php, even though they didn't ask for that.

So everything worked. In fact, everything worked *perfectly*. But then I decided that I wanted to add some special kinds of functionality to my site--in particular, functionality that can be achieved better with Java than with PHP. So I went to the hosting control panel, and clicked the button to "enable support for Java."

This takes a little while to process, and effectively turns on Apache Tomcat. I know very little about Tomcat, just that it's needed for Java in many cases. Ever since I did that, my site doesn't really work anymore.

Any RewriteRules in .htaccess are completely ignored for extensionless requests, and I based a good deal of my site on such requests. So now, if I try to access mydomain.com/search, I get a 404 error instead of seeing the search.php as I should.

I found the article below on the GoDaddy Help Center. It has a long list of file extensions that are handled by Apache, while "files not appearing in this list are processed by Tomcat" and therefore "bypass [the .htaccess] settings." And since my "extensionless" requests obviously are not on this list, it is clear that any corresponding RewriteRules are being bypassed completely.
http://help.godaddy.com/article.php?article_id=1133

WHAT I WOULD LIKE TO KNOW:
Is there some fix for this? Some way to tell Apache/Tomcat/Whatever that it should process the htaccess settings for "extensionless" files? And more importantly, is there some concise set of instructions I can tell the support reps to do in order to resolve this issue?

Thanks very much in advance. You don't want to know some of the answers that the support reps gave me. I really appreciate any help you guys can offer.Start Free Trial
[+][-]03.20.2007 at 09:19AM PDT, ID: 18757479

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Web Servers, Apache Web Server, Apache Tomcat Application Server
Tags: tomcat, extensionless, mod_rewrite
Sign Up Now!
Solution Provided By: mrcoffee365
Participating Experts: 1
Solution Grade: A
 
 
[+][-]03.20.2007 at 09:25AM PDT, ID: 18757548

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.20.2007 at 10:00AM PDT, ID: 18757877

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32