OK. I found one problem. The application is supposed to send a string saying "NULL" when the key is not found rather than a newline. So I changed print "\n" to print "NULL\n".
The problem now is that I'm getting an internal server error. I feel the rule keeps triggering recursively, isn't rules supposed to be a one time pass? Any help appreciated :) On Wed, Mar 3, 2010 at 10:30 AM, Ashraf Amayreh <[email protected]>wrote: > Hello all, > > If this is not the right place for this question I appreciate if someone > points me to some resources or mailing lists where I can ask. I have a > couple of rewrite rules that simply refuse to work. Without too much noise, > I'll post them here: > > RewriteCond %{HTTP_HOST} !^apps.example.com > RewriteCond %{HTTP_HOST} ^(.*).example.com > RewriteRule ^(.*)$ ${res:%1}/$1 [QSA] > > The logic here is: > > 1. make sure the URL does not start with apps > 2. isolate the first part of the URL and send it to an external app: The > external app either returns "members/<subdomain>" or nothing. The > alternative return values in the app are: > print "\n"; OR > print "members/{$subdomain}\n"; > 3. That's it. > > The idea is that if I provide a subdomain such as: > - abc.example.com, I want it to pass through unchanged > - def.example.com should be rewritten to def.example.com/members/def > > Am I doing something wrong here? Debugging rewrite rules seems to be > something next to impossible so I'm left without many alternatives than to > ask someone more knowledgeable than me. > > -- > Best Regards, > Ashraf Amayreh > CEO | O-Minds > Cell. 962 78 8099997 > Tel. 962 6 5655150 > Fax. 962 6 5675150 > > o-minds.com > web development | web design > user experience | branding design > -- Best Regards, Ashraf Amayreh CEO | O-Minds Cell. 962 78 8099997 Tel. 962 6 5655150 Fax. 962 6 5675150 o-minds.com web development | web design user experience | branding design
