I've got a rails application where clients register and obtain a custom subdomain site/url such as this:
Do you know the steps I have to decide to try allow a person to make use of their very own registered domain title so that their domain indicates my application?
So, within the example above, if "customer1" is the owner of "customer1.com" - how do i setup my application to ensure that any demands to "customer1.com" are delivered to "customer1.myapp.com"? Also, an amount my customer have to do on his finish?
Your customer needs to setup DNS For his or her domain to suggest it, or some of it, for your address. This is often tricky to coordinate, particularly if the address from the server you are hosting the service on can alter every so often. It is a lot simpler to route a customer's subdomain for your subdomain.
You'll also require a research table that maps a customer's domain to some customer's account. That's typically expressed as something similar to this:
before_filter :load_customer_from_host def load_customer_from_host # Strip "www." from host name to search only by domain. hostname = request.host.sub(/^www\./, '') @customer = Customer.find_by_host!(hostname) rescue ActiveRecord::RecordNotFound render(:partial => 'customer_not_found', :layout => 'application', :status => :not_found) end
That presumes you've got a Customer model having a 'host' area set with something similar to 'customer1.myapp.com' or 'customer1.com', whatever matches the host area.
Whenever you setup your application, you will have to possess a virtual host configuration that responds to any or all arbitrary domains. This really is simple to do if it's the only real site located, since that's the default behavior. If you are carrying this out on hosting that is shared you might want to configure an alias for every customer domain particularly, which may be an annoyance.