# Relative\_url\_root and problems with CSS url()

**URL:** <https://www.ruby-forum.com/t/relative-url-root-and-problems-with-css-url/125537>\
**Category:** Rails\
**Created:** [January 9, 2008, 11:44pm UTC](https://www.ruby-forum.com/t/relative-url-root-and-problems-with-css-url/125537 "2008-01-09T23:44:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mememe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/977dab/32.png) [@mememe](https://www.ruby-forum.com/u/mememe)\
**Post date:** [January 9, 2008, 11:44pm UTC](https://www.ruby-forum.com/t/relative-url-root-and-problems-with-css-url/125537/1 "2008-01-09T23:44:33Z")

</div>

I’m using relative\_url\_root to allow my app to be run from a sub-  
domain. Things work fine except with images that are referenced in my  
CSS code.

For example,  
background-image: url(/images/bg\_image.jpg);  
does not take into account the value in relative\_url\_root.  
Consequently, my background image (and other images similarly  
referenced in my stylesheet) are not loadable.

Anyone know a workaround?

Thanks,

-A.

---

<div class="post-metadata">

**Author:** ![mememe](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/977dab/32.png) [@mememe](https://www.ruby-forum.com/u/mememe)\
**Post date:** [January 10, 2008, 7:36pm UTC](https://www.ruby-forum.com/t/relative-url-root-and-problems-with-css-url/125537/2 "2008-01-10T19:36:18Z")

</div>

I hear relative\_url\_root works only (mahbe) with Apache, so I can  
probably assume that’s what you’re using? Then I will.

You’ll probably have to use mod\_rewrite in your .htaccess file, and  
point the /images/ folder to wherever your images are… I can’t help  
much more than that since I haven’t gotten much experience with  
relative\_url\_root, though.

-Ryan
