[development] mod rewrite rules question

Jamie Holly hovercrafter at earthlink.net
Wed Mar 3 13:37:57 UTC 2010


That's exactly what's happening. You are sending an internal request to 
another page, so .htaccess is parsed again and tries to rewrite again 
(and again and again).

Here's a simple solution that I think will achieve what you want:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^apps\. [NC]
RewriteCond %{HTTP_HOST} ^([^.]+).example.com$
#Below stops the looping by making sure the request isn't for what you 
rewrote the request too.
RewriteCond %{REQUEST_FILENAME} !^members/index.php
RewriteRule (.*) members/index.php?sd=%1&q=$1 [L,QSA]

Now in your application you'll have 2 $_GET variables. One will be 'sd' 
containing the subdomain and then 'q' (to use some Drupal goodness) that 
contains the request path.

Jamie Holly
http://www.intoxination.net
http://www.hollyit.net


On 3/3/2010 5:24 AM, Ashraf Amayreh wrote:
> Afraid not, adding an [L] didn't do any good. I'm still getting an 
> internal server error that I'm presuming is caused by applying the 
> rule indefinitely to the rewritten result. Is this the normal behavior 
> of .htaccess files? I'm pasting the full content of the .htaccess file 
> on the site root:
>
> RewriteEngine On
> RewriteCond %{HTTP_HOST} ^(.*).example.com <http://example.com>
> RewriteRule (.*) ${tryme:%1}/$1 [L]
>
> I'm very sure the application is working properly because I can run it 
> standalone and it works fine (returns either NULL or key followed by 
> newline).
>
> -- 
> Best Regards,
> Ashraf Amayreh
> CEO | O-Minds
> Cell. 962 78 8099997
> Tel. 962 6 5655150
> Fax. 962 6 5675150
>
> o-minds.com <http://o-minds.com>
> web development | web design
> user experience | branding design
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20100303/83c9b009/attachment.html 


More information about the development mailing list