简体   繁体   中英

How do I route by domain / subdomain in rails

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM