Handling multiple domain accounts for accessing a single web app.

hi all,

Here is the question, Is there a way to set multiple domain name for accessing a single rails application,

below are my requirements

* based on the domain i need to show pages based on their settings.

* how to manage the settings at application.rb file.

* the base domain url should be maintained. i am not here for discussing about subdomains.

scenario :

i have a site www.a.com, i have different users to my site with their own domains and settings set. for eg.

1. www.b.com and their settings B 2. www.c.com and their settings C

when a user access www.b.com it should be redirected to www.a.com with the pages listed with settings B.

is this possible, if so please provide a detailed reply...

thanks in advance..

Regards, Jacob v thomas

Bump.

Is there a way to handle multiple domains including being able to use different templates for different domains?

account_location plugin, then use account_domain and use it as a key in your access management.

Different templates, same functionality: either switch the stylesheet (CSS) or go un-DRY by using different view folders for each domain.

Best regards

Peter De Berdt

account_location plugin, then use account_domain and use it as a key in your access management. Different templates, same functionality: either switch the stylesheet (CSS) or go un-DRY by using different view folders for each domain.

The account_location plugin talks about subdomains. Do you know if it's suitable for different top level domains?

All it does is put some convenience methods around the built-in request.domain, request.subdomains and request.port_string methods. Sometimes it’s better to go and have a look at the actual code of the plugin to see what it does (and the code of account_domain is so simple even someone who never wrote a line of ruby would understand).

account_domain will return the domain and port without the subdomain part, examples:

www.rubyonrails.org => rubyonrails.org

www.rubyonrails.org:5000 => rubyonrails.org:5000

api.rubyonrails.org => rubyonrails.org

some.demo.app.rubyonrails.org => demo.app.rubyonrails.org

If you want just the domain and nothing else (port number, …), just request.domain is what you want.

Best regards

Peter De Berdt