Hi, I created a multi-domain application, and I wanted to add page caching, how can I tell Rails that it should save each cached page under a subfolder such as public/www.mysite1.com/ and public/www.mysite2.com -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Conrad Taylor
2009-Mar-27 07:34 UTC
Re: Different page caching folder for different domains
On Tue, Mar 24, 2009 at 2:07 PM, Fernando Perez < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Hi, > > I created a multi-domain application, and I wanted to add page caching, > how can I tell Rails that it should save each cached page under a > subfolder such as public/www.mysite1.com/ and public/www.mysite2.comIf you''re using page caching, then the cached page should located relative to the root of your website. Thus, if you were to access the index page on both www.mysite1.com and www.mysite2.com, the you should be able to find an index.html in the following locations: URL: www.mysite1.com/index.html On Disk: /rails-app1/public/index.html URL: www.mysite2.com/index.html On Disk: /rails-app2/public/index.html Now, if you really want to change the location of the cached pages to use another directory other than the above, you can do the following: Moving your Page Cache First you''d want to add the following to your */config/environment.rb*: config.action_controller.page_cache_directory = RAILS_ROOT + "/public/cache/" This tells Rails to publish all your cached files in the /public/cache directory. You would then want to change your Rewrite rules in your * httpd.conf* to be: 12345 # Rewrite index to check for static RewriteRule ^/$ cache/index.html [QSA] # Rewrite to check for Rails cached page RewriteRule ^([^.]+)$ cache/$1.html [QSA] If you would like to learn more about the wonderful world of caching, I would recommend reading the following: http://railslab.newrelic.com/ Good luck, -Conrad --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---