# Rails helpers are adding extra folders

**URL:** <https://www.ruby-forum.com/t/rails-helpers-are-adding-extra-folders/82983>\
**Category:** Rails\
**Created:** [January 22, 2007, 9:14pm UTC](https://www.ruby-forum.com/t/rails-helpers-are-adding-extra-folders/82983 "2007-01-22T21:14:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jjkiesch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bc79bd/32.png) [@jjkiesch](https://www.ruby-forum.com/u/jjkiesch)\
**Post date:** [January 22, 2007, 9:14pm UTC](https://www.ruby-forum.com/t/rails-helpers-are-adding-extra-folders/82983/1 "2007-01-22T21:14:38Z")

</div>

i have a new rails site that i am setting up just like i normally do  
with  
all of the other sites. i created a subdomain which is pointed to a  
subfolder in my public\_html.

i can view the site both at [test.mywebsite.com](http://test.mywebsite.com) and [mywebsite.com/test/](http://mywebsite.com/test/)  
but  
when i view it by the subdomain, rails helpers are adding the /test/ to  
all  
of my resources, so none of my images or style sheets are found.

this hasn’t ever happened to be before, so i’m not sure what to do. is  
there  
something else i have to add in my .htaccess file?

---

<div class="post-metadata">

**Author:** ![jjkiesch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bc79bd/32.png) [@jjkiesch](https://www.ruby-forum.com/u/jjkiesch)\
**Post date:** [January 22, 2007, 9:42pm UTC](https://www.ruby-forum.com/t/rails-helpers-are-adding-extra-folders/82983/2 "2007-01-22T21:42:41Z")

</div>

On Jan 22, 2007, at 9:13 PM, Joshua Kieschnick wrote:

> i have a new rails site that i am setting up just like i normally  
> do with all of the other sites. i created a subdomain which is  
> pointed to a subfolder in my public\_html.
> 
> i can view the site both at [test.mywebsite.com](http://test.mywebsite.com) and [mywebsite.com/](http://mywebsite.com/)  
> test/ but when i view it by the subdomain, rails helpers are adding  
> the /test/ to all of my resources

By default helpers create absolute paths

/images/foo.png

So the subdomain is the one that should work out of the box. Are you  
using custom options for them?

– fxn

---

<div class="post-metadata">

**Author:** ![jjkiesch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bc79bd/32.png) [@jjkiesch](https://www.ruby-forum.com/u/jjkiesch)\
**Post date:** [January 22, 2007, 10:14pm UTC](https://www.ruby-forum.com/t/rails-helpers-are-adding-extra-folders/82983/3 "2007-01-22T22:14:45Z")

</div>

not that i know of. i’ve set up apps on subdomains several times before  
too and they’ve all worked which is why i don’t understand how it’s  
prefixing all my links with /test/

---

<div class="post-metadata">

**Author:** ![jjkiesch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bc79bd/32.png) [@jjkiesch](https://www.ruby-forum.com/u/jjkiesch)\
**Post date:** [January 22, 2007, 10:19pm UTC](https://www.ruby-forum.com/t/rails-helpers-are-adding-extra-folders/82983/4 "2007-01-22T22:19:46Z")

</div>

just for kicks, i just tried to symlink my app to the root folder and  
it didn’t add the test prefix, only when it’s accessed by the subdomain.

---

<div class="post-metadata">

**Author:** ![jjkiesch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bc79bd/32.png) [@jjkiesch](https://www.ruby-forum.com/u/jjkiesch)\
**Post date:** [January 22, 2007, 10:33pm UTC](https://www.ruby-forum.com/t/rails-helpers-are-adding-extra-folders/82983/5 "2007-01-22T22:33:50Z")

</div>

On Jan 22, 2007, at 10:13 PM, Josh wrote:

> not that i know of. i’ve set up apps on subdomains several times  
> before  
> too and they’ve all worked which is why i don’t understand how it’s  
> prefixing all my links with /test/

Have you set RAILS\_RELATIVE\_URL\_ROOT? Can you check your rewrite  
rules, if any?

– fxn

---

<div class="post-metadata">

**Author:** ![jjkiesch](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bc79bd/32.png) [@jjkiesch](https://www.ruby-forum.com/u/jjkiesch)\
**Post date:** [January 22, 2007, 10:41pm UTC](https://www.ruby-forum.com/t/rails-helpers-are-adding-extra-folders/82983/6 "2007-01-22T22:41:51Z")

</div>

i had an admin restart the server, and now the urls are working right.  
weird.

do they get locked in when the app starts even when it’s not in  
production?
