agiletortoise-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Aug-23 21:46 UTC
[Rails] Setting base url for a rails app
I''ve got a rails app that can be accessed either via: http://[domain]/ or http://[domain]/[folder]/ The public directory of the app is actually symlinked at /[folder]/, and accessible at the root path via .htaccess. Yep, you guessed it, this is a shared host. I can''t seem to figure out how to tell rails that the root path (/) is the preferred site url, so that url_for and related calls will build links with that path, rather than including [folder]/ Is there an easy way to do this? Thanks, greg. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
agiletortoise-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> I''ve got a rails app that can be accessed either via: > > http://[domain]/ > or > http://[domain]/[folder]/ > > The public directory of the app is actually symlinked at /[folder]/, > and accessible at the root path via .htaccess. > > Yep, you guessed it, this is a shared host. > > I can''t seem to figure out how to tell rails that the root path (/) is > the preferred site url, so that url_for and related calls will build > links with that path, rather than including [folder]/ > > Is there an easy way to do this? > > Thanks, greg. > > > > >I am assuming that you are using lighttpd. You can use a simple symlink to get your site in a subdirectory to play nice. I go over how to do things at http://blog.mattmargolis.net/articles/2006/08/01/rails-in-a-subdirectory-apache-lighttpd-mixed-environment Basically you just use relative_url_root and |cd /sites/rails/somerailssite/public ln -s . somerailssite | |This will get all requests to http://[domain]/folder to hit the public folder of your application.| |Then you just need to configure your lighttpd.conf file to hit up your rails application in the subdirectory when you go to http://domain If you need help with the lighttpd part just ask. | |||| |Matthew Margolis blog.mattmargolis.net| || | | --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
agiletortoise-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Aug-24 13:58 UTC
[Rails] Re: Setting base url for a rails app
Turns out all I needed was to add this to my environment.rb: ActionController::AbstractRequest.relative_url_root = "" Thanks! g. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---