It appears this message bounced somehow, so I''m resending. Apologies
if it is a dup.
Begin forwarded message:
> From: Duane Johnson
<duane.johnson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Date: July 29, 2005 8:59:30 AM MDT
> To: Steve Sloan <steve-2FdKsI0tZ45AfugRpC6u6w@public.gmane.org>,
rails-1W37MKcQCpIf0INCOvqR/pqQE7yCjDx5@public.gmane.org
> Subject: Re: Products and mod_rewrite
>
>
>
> On Jul 28, 2005, at 2:25 PM, Steve Sloan wrote:
>
>
>> Well, I finally got around to using the rails_product and site
>> generators to rework my site(s), but I''ve run into a nasty
problem
>> with mod_rewrite and the rules for fetching site-specific and
>> generic static content.
>>
>> From SITE_ROOT/public/.htaccess:
>>
>> # If the requested file does not exist in SITE_ROOT/public...
>> RewriteCond %{REQUEST_FILENAME} !-f
>> # ... then split its full path up in to manageable pieces ...
>> RewriteCond %{REQUEST_FILENAME} ^(.*)/sites/.+/public/(.*)$
>> # ... and check to see if the file exists in the RAILS_ROOT/
>> public folder...
>> RewriteCond %1/public/%2 -f
>> # ... if so, rewrite our requested file to be the RAILS_ROOT one
>> RewriteRule ^(.*)$ /generic/$1 [NS,L]
>>
>> However, looking at the rewrite log for URL "/javascripts/
>> prototype.js" I see ...
>>
>> [per-dir /var/www/rails/sites/foo/public/] add path info postfix:
>> /var/www/rails/sites/foo/public/javascripts -> /var/www/rails/
>> sites/foo/public/javascripts/prototype.js
>>
>> [per-dir /var/www/rails/sites/foo/public/] strip per-dir prefix:
>> /var/www/rails/sites/foo/public/javascripts/prototype.js ->
>> javascripts/prototype.js
>>
>> [per-dir /var/www/rails/sites/foo/public/] applying pattern
''^
>> (.*)$'' to uri ''javascripts/prototype.js''
>>
>> RewriteCond:
input=''/var/www/rails/sites/foo/public/javascripts''
>> pattern=''!-f'' => matched
>> RewriteCond:
input=''/var/www/rails/sites/foo/public/javascripts''
>> pattern=''^(.*)/sites/.+/public/(.*)$'' => matched
>> RewriteCond:
input=''/var/www/rails/public/javascripts'' pattern=''-
>> f'' => not-matched
>>
>> It appears that, for some reason, Apache is stripping-off the
>> filename and just looking at the directory. Since, obviously, no
>> directory will match ''-f'', it will never switch to
using the
>> generic content directory. Oddly enough, it doesn''t strip the
>> filename when I''m grabbing site-specific content, so that
works,
>> and it doesn''t have a problem with generic content under the
"/
>> generic/" URL. It''s just the rewrite rule to go from one
to the
>> other ...
>>
>> Is anyone else seeing this? BTW, this is under FC4 (Apache 2.0.54).
>>
>> -- Steve
>>
>>
>
> Steve,
>
> I did see this problem while I was setting up the Apache rules.
> Interestingly enough, I''m running Apache 1.3 so whatever
we''re
> seeing here is across the full spectrum of mod_rewrite.
>
> After the problem occurred, I played around with the rules a bit,
> and then put them back as they were (as you have them in
> rails_product) and suddenly it just worked. The rules you are
> running now are working for me--although I know they weren''t
> working at one point. I have no explanation yet.
>
> One thing you might try is to create another site and see if the
> new site works as expected. I found that the rewrite rule would
> work for one site but not the other. Very strange.
>
> If you have any success, or further clues as to its cause, please
> let me know!
>
> Duane Johnson
> (canadaduane)
>
>
>
Duane Johnson
(canadaduane)
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails