From: Tanner Burson Date: 2005-02-17T05:58:59+09:00 Subject: Re: Rails question On Thu, 17 Feb 2005 05:51:18 +0900, Ochronus wrote: > Thanks for your help, I did what you adviced, but the result is weird. > > At first load (first time it's opened in the browser) everything's fine, > it generates good urls. Then if I click one of these hrefs, the second > time the page loads, it seemingly adds the prefix _again_ > > As for an actual example: > First time link: > http://www.all.hu/ochronus/blog/public/categories/show/2 > > When I click this href, it reloads the page, and the same href changes to: > http://www.all.hu/ochronus/blog/public/ochronus/blog/public/categories/show/2 > > What could be causing this? How could I avoid it? > Make sure to set the attribute in the HEAD section of your rhtml template to http://www.all.hu . This should tell the browser that paths all start relative to that directory, not whatever the URL appears to be. > Thank you, > Ochronus > > > David Heinemeier Hansson wrote: > >> This brought up a former problem of mine: I was not able to deploy a > >> single rails app to an apache www-root subdirectory, because all the > >> automatically generated links (link_to, actions, etc.) pointed at > >> www.servername.com/action instead of > >> www.servername.com/ochronus/rails_app/action. I couldn't find any > >> workaround, and even "googling" was no good... Does anyone have an idea? > > > > > > You can use :application_prefix. You can even set this as a default > > rewrite option if all your rewrites needs to be made with this prefix. > > Example: > > > > class ApplicationController > > protected > > def default_url_options(options) > > { :application_prefix => "ochronus/" } > > end > > end > > -- > > David Heinemeier Hansson, > > http://www.basecamphq.com/ -- Web-based Project Management > > http://www.rubyonrails.org/ -- Web-application framework for Ruby > > http://www.loudthinking.com/ -- Broadcasting Brain > > > > > > > >