Agile Tortoise

Greg Pierce’s blog

« Squidly Diddly, reprise      Last minute donations! »

Set base path for Rails app

After a bit of searching, I finally figured out how to force Rails to use a particular base path when generating url via any of the various methods that pass through “url_for.” Add the following line to your environment.rb file:

ActionController::AbstractRequest.relative_url_root = "/[basepath]"

Wednesday, August 23rd, 2006 at 7:56 pm and is filed under Ruby on Rails. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

4 Responses to “Set base path for Rails app”

  1. GSIY … Ruby-Rails Portal Says:
    October 1st, 2007 at 3:07 pm

    [...] See also http://greg.agiletortoise.com/2006/08/23/set-base-path-for-rails-app/ [...]

  2. GSIY … Ruby-Rails Portal Says:
    October 1st, 2007 at 3:12 pm

    [...] On 9/26/07, Frederick Cheung <rails-mailing-list@…> wrote: > > I changed   map.connect ‘:controller/:action/:id’ to >  map.connect ‘foo/:controller/:action/:id’ > and restarted the server. > > See also > http://greg.agiletortoise.com/2006/08/23/set-base-path-for-rails-app/ [...]

  3. GSIY … Ruby-Rails Portal Says:
    October 2nd, 2007 at 6:10 am

    [...] > > and restarted the server. > > > See also > >http://greg.agiletortoise.com/2006/08/23/set-base-path-for-rails-app/ > > Both good info, thanks! > > – > Hassan Schroeder [...]

  4. xtrem Says:
    June 8th, 2008 at 1:15 pm

    Very very good, Greg. It work perfectely for my Rails app that is in a particular directory of my domain.

Leave a Reply