I am somewhat of an apache newb -- let's get that out of the way first thing! I'm trying to set up "taffy", a REST API framework, on my railo instance, and I cannot for the life of me get this rewrite to work. I got it set up just fine with Coldfusion / IIS 7, but I can't replicate the results in apache.
Basically, the framework relies on getting requests like so:
/api/index.cfm?endpoint=/resource
That's fine, but it's obviously not RESTful. They say in the "taffy" docs that without any extra rules you should be able to simply call "/api/index.cfm/resource" but I've never had that work. Anyway, I want you to be able to type "/api/resource" into the URL bar and have it just work without changing the URL back to ugly "/api/index.cfm?endpoint=/resource".
Here are my rewrite rules:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule api/(.*)$ /api/index.cfm?endpoint=/$1 [QSA,L]
Looking at the logs, this is getting the URL correctly rewriting it to "/api/index.cfm?endpoint=/resource". Then, it breaks off the "?endpoint=/resource", decides it doesn't like it, and redirects simply to "/api/index.cfm"... which does nothing.
Now, as I understand it, apache is taking the query string and hiding it in the cgi QUERY_STRING variable. Railo needs to get the "endpoint" variable out of URL scope, not CGI scope.
Is there any way I can accomplish what I'm trying to do here? Incidentally, if I add R or R=301 tags as I've seen suggested, I just get put in an infinite redirect loop, which I also can't explain. At this point I'd almost be happy with a plain old redirect, but I can't get out the loop. What am I doing!!?