[development] mod rewrite rules question

Lee Rowlands leerowlands at rowlands-bcs.com
Wed Mar 3 10:07:48 UTC 2010


>From memory (a long time ago) you need a [L] on the end of a line to force
it to stop

 

From: development-bounces at drupal.org [mailto:development-bounces at drupal.org]
On Behalf Of Ashraf Amayreh
Sent: Wednesday, 3 March 2010 8:03 PM
To: development at drupal.org
Subject: Re: [development] mod rewrite rules question

 

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 <mistknight at gmail.com>
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

Internal Virus Database is out of date.
Checked by AVG - www.avg.com
Version: 8.5.406 / Virus Database: 271.1.1/2686 - Release Date: 02/13/10
19:35:00

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20100303/7e609c3a/attachment-0001.html 


More information about the development mailing list