Robby on Rails で概説されているように、Mac OSX でサブドメインを正常に実行しています。以下のコード例に従いたいのですが、どこから始めればよいかわかりません。DNS 設定を編集するにはどうすればよいですか? これを行うには、専用の仮想ホストが必要ですか? 現在、標準の (安っぽい) Dreamhost 共有ホスティングを使用しています。DVH を使用する場合、メディア テンプルが適していますか?
メディアのレコは役に立ちます - 私のグーグル検索は、怒っている顧客/ホスティング会社のティレードだけをもたらしました.
ありがとう!
# 1) Point *.example.com in your DNS setup to your server.
#
# 2) Setup an Apache vhost to catch the star pointer:
#
# <VirtualHost *:80>
# ServerName example.com
# ServerAlias *.example.com
# </VirtualHost>
#
# 3) Set the current account from the subdomain
class ApplicationController < ActionController::Base
before_filter :set_current_account
private
def set_current_account
@current_account = Account.find_by_subdomain!(request.subdomains.first)
end
end
# 4) Tie all top-level requests off the current account
class CustomersController < ApplicationController
def index
@customers = @current_account.customers
end
end