lo there all, i am running two websites on one server. Both use the same code and both domains point to the same public folder. I use different logos by using a session variable called session[:domain] that i find with env_table[''HTTP_HOST''] so anyway, both need a different icon to go in the bookmarks and url, i know this is done with a favicon.ico, but can i force the server to use one for one domain and a different one for the other domain ? if so, how ? thanks -- 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 -~----------~----~----~----~------~----~------~--~---
On Jan 17, 2007, at 6:39 PM, Shawn Bright wrote:> i am running two websites on one server. Both use the same code and > both > domains point to the same public folder. I use different logos by > using > a session variable called session[:domain] that i find with > env_table[''HTTP_HOST''] > > so anyway, both need a different icon to go in the bookmarks and > url, i > know this is done with a favicon.ico, but can i force the server to > use > one for one domain and a different one for the other domain ?If that''s the same Rails application running behind two you could use rewrite rules per virtual host: # first virtual host RewriteEngine On RewriteRule ^favicon.ico$ favicon-vh1.ico [L] # second virtual host RewriteEngine On RewriteRule ^favicon.ico$ favicon-vh2.ico [L] That''s written off the top of my head but you see the idea. -- fxn --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
ok, cool, where do i write those ? thanks shawn -- 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 -~----------~----~----~----~------~----~------~--~---
On Jan 17, 2007, at 7:04 PM, Shawn Bright wrote:> ok, cool, where do i write those ?In the configuration of each vhost. -- fxn --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
thanks Xavier, do i still put the icons in /public/images if both sites are automatically routed to /users/index.rhtml? thanks -- 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 -~----------~----~----~----~------~----~------~--~---
On Jan 17, 2007, at 7:39 PM, Shawn Bright wrote:> > thanks Xavier, > do i still put the icons in /public/images if both sites are > automatically routed to /users/index.rhtml?That is not its canonical place, but since we are using rewrite rules you can (tweaking the right-side in the examples I sent before). You can leave them under public if you want as well. As you know favicon.ico is normally requested by browsers automatically. That is, you don''t link to it, except perhaps by a LINK element like this one in the HEAD of your layout: <!-- following the guidelines in http://en.wikipedia.org/wiki/ Favicon --> <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" /> Now, if I understand the setup correctly you have two vhosts pointing to the same Rails application. In particular they share the public directory which is the root of the problem. The browser will still ask for http://www.vhost1.com/favicon.ico and http://www.vhost2.com/favicon.ico respectively when they visit any page on those websites. The point is that you don''t even have a favicon.ico under public. You instead have two different .icos somewhere under public and have rewrite rules fool the browser. Each vhost has a different rewrite rule that rewrites internally the URL to serve its corresponding .ico. Perhaps you are not used to this stuff, the browser won''t know it is getting something called some other thing in the filsystem of the server, nor that the URL was mangled, / favicon.ico will be retrieved as if existed. With this setup both .icos are _available_ using direct URLs since the document root is shared, but only the corresponding one will be served as /favicon.ico, which is what we want. -- fxn --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
ok, i appreciate your help a lot, i am still having trouble with it. i put both icons just in the /public directory of the rails app. and here is what i have in the virtual host file for one of the sites <VirtualHost *> SetEnv RAILS_ENV production ServerName www.mysite.com DocumentRoot /var/www/mysite/public <Directory /var/www/mysite/public/> Options ExecCGI FollowSymLinks AddHandler fcgid-script .fcgi Order allow,deny Allow from all RewriteEngine On RewriteRule ^favicon.ico$ site_a_icon.ico [L] RewriteRule ^$ index.html [QSA] RewriteRule ^([^.]+)$ $1.html [QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ /dispatch.fcgi?$1 [QSA,L] AllowOverride None </Directory> ServerSignature On # ErrorDocument 500 /500.html ErrorLog /var/log/apache2/pivotrac/error.log CustomLog /var/log/apache2/pivotrac/access.log combined LogLevel warn </VirtualHost> can you see anything that is obvious that i am doing wrong here? thanks -- 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 -~----------~----~----~----~------~----~------~--~---
On Jan 18, 2007, at 1:22 AM, Shawn Bright wrote:> can you see anything that is obvious that i am doing wrong here?Sorry for the delay, I''ve been quite busy lately. The configuration looks OK to me. I have always put my rewrite rules outside the Directory section <VirtualHost ...> <Directory ...> </Directory> RewriteRule ... ... </VirtualHost> but if the FCGI dispatcher is being called the rewrite rules are working fine. Did you tell Apache to reload the configuration? -- fxn --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
never got back to you on this, but wanted to let you know that your solution worked, thanks sk -- 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 -~----------~----~----~----~------~----~------~--~---