Welcome Guest | Login

linking to css, js files using subdomains

Hello folks,
I have two subdomains on my account
demo.youthspring.org and teledu.youthspring.org
the thing is, that after killall.. whichever subdomain I hit first
gets displayed as desired.
Afterwards the other subdomain wont display properly. It seems that any links to the public folder (css, js, pics) stop working. As if the paths are somehow cached or whatever

any ideas?

many thanks!
Spyros

2007-03-26 04:13 AM

Just to make sure I'm understanding you correctly:

So, for example, when you access first ~/public_html/teledu in your browser everything works....but then when you try access ~/public_html/demo/images/some_image.jpg you get a 404?  or what exactly is the problem?

2007-03-26 04:23 AM

hmm as i see now, when hitting http://teledu.youthspring.org css works
yet when hitting http://teledu.youthspring.org/account/login
it doesnt

2007-03-26 04:30 AM

The css issue is almost always a problem with the rewrite rules in your .htaccess file.  Most commonly because the route to the dispatcher is above the routes to static content.  Check that out.  Otherwise, do you have any special settings in your environment.rb for paths?  (e.g. base_urls?)

2007-03-26 04:34 AM

lets see, here's how my htaccess looks like..

# General Apache options
# AddHandler fastcgi-script .fcgi
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI

# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite certain requests
#
# Example:
#   RewriteCond %{REQUEST_URI} ^/notrails.*
#   RewriteRule .* - [L]

# Redirect all requests not available on the filesystem to Rails
# By default the cgi dispatcher is used which is very slow
#
# For better performance replace the dispatcher with the fastcgi one
#
# Example:
#   RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
   
RewriteEngine On

# If your Rails application is accessed via an Alias directive,
# then you MUST also set the RewriteBase in this htaccess file.
#
# Example:
#   Alias /myrailsapp /path/to/myrailsapp/public
#   RewriteBase /myrailsapp

RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
# RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
  RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]


its a standard mephisto installation with only the changes that are suggested in http://www.hostingrails.com/forums/wiki_thread/29

2007-03-26 04:51 AM

which .htaccess is this?  ~/public_html/teledu/.htaccess   ?   and you don't have any path issues in your environment.rb?   did you do the same exact thing with your demo subdomain and that works completely?



2007-03-26 05:14 AM

ok, sorry. the above is the teledu hta (identical to demo's hta)
yet notice that "teledu" is a symlink in ~/public_html/ and thus it's .hta is in teledu/public/ (but I suppose that doesnt make any difference).
So Yes .hta on demo is the same and works




here's my environment.rb for teledu (unchanged as delivered with mephisto)...


# Be sure to restart your web server when you modify this file.

# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
ENV['RAILS_ENV'] ||= 'production'

#require 'rubygems'
#require 'ruby-debug'
#Debugger.start

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')

# requires vendor-loaded redcloth
require 'RedCloth-3.0.4/lib/redcloth' unless Object.const_defined?(:RedCloth)
Rails::Initializer.run do |config|
 # Settings in config/environments/* take precedence those specified here
 
 # Skip frameworks you're not going to use
 # config.frameworks -= [ :action_web_service ]

 config.load_paths += %W( #{RAILS_ROOT}/app/cachers #{RAILS_ROOT}/app/drops #{RAILS_ROOT}/app/filters )

 # Force all environments to use the same logger level
 # (by default production uses :info, the others :debug)
 # config.log_level = :debug

 # Use the database for sessions instead of the file system
 # (create the session table with 'rake create_sessions_table')
 config.action_controller.session_store = :active_record_store

 # Make Active Record use UTC-base instead of local time
 config.active_record.default_timezone = :utc
 
 # Use Active Record's schema dumper instead of SQL when creating the test database
 # (enables use of different database adapters for development and test environments)
 config.active_record.schema_format = :ruby
end

# Include your application configuration below
require 'mephisto_init'

# Set this if you're running under a sub directory
# ActionController::AbstractRequest.relative_url_root = '/blog'

# turn this on to get detailed cache sweeper logging in production mode
# Site.cache_sweeper_tracing = true

# Enable if you want to host multiple sites on this app
# Site.multi_sites_enabled = true

# shouldn't need to set the host, it's set automatically
UserMailer.default_url_options[:host] = 'localhost:3000'
UserMailer.mail_from = 'webmaster@localhost'

# OPTIONAL - Redirections
# Deny a route by immediately returning a 404
#
#   Mephisto::Routing.deny 'articles/trackback/*' # return 404
#
# Specify multiple denied routes:
#
#   Mephisto::Routing.deny 'articles/trackback/*', 'monkey/foo/*'
#
# Redirect elsewhere.  You can fill in variables marked by ? or * with variable names beginning with :
#
# Redirect /old/foo to /new/foo and /old/foo/bar to /new/foo/bar
#
#   Mephisto::Routing.redirect 'old/*' => 'new/$1'
#
# Redirect with a more specific set of variables
#
#   Mephisto::Routing.redirect 'article/?/?/?' => 'new/$2/$1/$3'

# Multiple redirections at a time
#
#   Mephisto::Routing.redirect \
#     'old/*' => 'new/$1',
#     'article/?/?/?' => 'new/$2/$1/$3'

2007-03-26 05:33 AM

Other than the fact that I wouldn't recommend storing sessions in a database, esp in a shared environment, I don't see anything wrong.  If you have two subdomains that are set up identically and one works while the other doesn't - that is indeed strange.  If you browse to the non-working app first does that one work and the other not?  Either way - I'd probably recommend contacting support.

2007-03-26 12:34 PM

got it!
i simply used the hta file as in http://mephisto.stikipad.com/help/show/HostingMultipleSites

2007-03-26 03:08 PM


Hello Guest! In order to post you must be an active client with us, please log in or sign up.