Forum: Ruby on Rails pages in /public cant find CSS

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7a0fbbfc7e105b4a7911eca807eee059?d=identicon&s=25 Mat Cucuzella (kook)
on 2006-05-11 05:45
Hi everyone,

I have a rails project that I've been serving via WebBrick at work,
and its been working fine (low traffic). For the last few days I've
been trying to deploy it under Apache which already serves our groups
static and PHP pages. I have the dynamic rails part working now, but
am having problems with stylesheet references in static pages. My URL
using WebBrick was (and still is for development):

   http://myhost.com/

and now in Apache its below root since docroot has lots of existing
stuff:

   http://myhost.com/auto/

which in apache-land points to my rails public directory. The problem
is in the static HTML pages in public. They reference CSS files shared
with dynamic rails pages in /stylesheets. Under my WebBrick setup this
was OK, but under my new Apache setup they are in /auto/stylesheets,
so they are not loaded. Is there a good way to make the stylesheets
visible in both environments?

This seems like it would be a common problem. Are there best practices
for handling this situation? Also if anyone wants to comment on
ownership/permissions between my UID and under Apache it needing at
least r/w permissions to some files and dirs.

I'm using Rails 1.0 under Linux, RedHat AS 3.0.

-mat
E3c79c779c0b390049289cdfe7cb9705?d=identicon&s=25 Bob Hutchison (Guest)
on 2006-05-11 18:13
(Received via mailing list)
Hi mat,

On May 10, 2006, at 11:45 PM, mat Cucuzella wrote:

>
> visible in both environments?
>
> This seems like it would be a common problem. Are there best practices
> for handling this situation? Also if anyone wants to comment on
> ownership/permissions between my UID and under Apache it needing at
> least r/w permissions to some files and dirs.

To paraphrase what is happening: you're using absolute urls (leading
'/') and that these urls fix the location of the page in question,
and that the pages are static. If that is correct, then I think you
need to change to relative urls. Instead of writing "/stylesheets",
write "stylesheets".

Hope that helps a bit.

Cheers,
Bob

> http://lists.rubyonrails.org/mailman/listinfo/rails
----
Bob Hutchison                  -- blogs at <http://www.recursive.ca/
hutch/>
Recursive Design Inc.          -- <http://www.recursive.ca/>
Raconteur                      -- <http://www.raconteur.info/>
xampl for Ruby                 -- <http://rubyforge.org/projects/xampl/>
7a0fbbfc7e105b4a7911eca807eee059?d=identicon&s=25 Mat Cucuzella (kook)
on 2006-05-11 20:46
Bob Hutchison wrote:
> To paraphrase what is happening: you're using absolute urls (leading
> '/') and that these urls fix the location of the page in question,
> and that the pages are static. If that is correct, then I think you
> need to change to relative urls. Instead of writing "/stylesheets",
> write "stylesheets".

Ohhh. What an amature mistake :-) Thanks! That worked great.

-mat
This topic is locked and can not be replied to.