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