Pages in /public cant find CSS


#1

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


#2

Bob H. 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 :slight_smile: Thanks! That worked great.

-mat


#3

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 H. – 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/