问题
I looked at subdomain-fu and it looks pretty easy to route all non-www and non-'' subdomain requests to a single controller.
But I also, need to send all external domains that are CNAME'd to my domain to the same controller. I have done a lot of searching and I can't find anything.
Summarized, if it is a subdomain on my domain it goes to Catchall controller, if it is any other domain than my domain, it goes to the same Catchall controller.
I am going nuts on this, any help would be appreciated.
回答1:
You should check out the request_routing plugin. It allows you to easily route request by: subdomain, domain, method, port, remote_ip, content_type, protocol, etc.
来源:https://stackoverflow.com/questions/2283755/how-do-i-route-by-domain-subdomain-in-rails