small medium large xlarge

30 Aug 2008, 00:33
Robby Dhillon (1 post)

Your tutorial on giving users their own unique subdomain or domain is great but lacks one thing:

Request routing in such application. How do you tell rails which controller to use based on URL that is request? Let’s say my product site has the following URL “”:#, now, how can I prevent my users from exploiting the system in case they visit “”:#??? Also, can an application like such have a root mapping for the controller? ie ~~~ map.root :controller => “site” ~~~ …??? Also, how would I go about allowing the users to ONLY login from their subdomain or domain specific site and not the product site, ie users should only be able to login by either visiting “”:# or “”:# and not via “”:# …also, how would I go about have my product site at “”:# instead of “”:#…these are some of my unanswered questions and would help to have them explained in bit more detail. Thank you. Btw, I have already checked out ‘Request Routing’ & ‘Tricky Routes’ plugins but for some reason they both do not play well with Rails 2.1.0. An alternative solution would be helpful without the use of a plugin.


Screen shot 2016-02-29 at 16.55.11_pragsmall
14 Dec 2009, 18:52
Bob (6 posts) Examples: users_path(:subdomain => “fun”) users_url(:subdomain => false) map.with_options :conditions => {:subdomain => ‘admin’} do |admin| admin.resources :posts admin.resources :users end

SubdomainFu provides a modern implementation of subdomain handling in Rails. It takes aspects from account_location, request_routing, and other snippets found around the web and combines them to provide a single, simple solution for subdomain-based route and url management.

You must be logged in to comment