Link: Adding Support for Custom Domains in Rails
There are three main steps necessary for adding custom domain support to your Rails project:
- Have your users add a CNAME record pointing their domain to yours
- Update your routes to handle any custom domains.
- Add the controller logic to find resources using the custom domain
For this example, let’s assume your user wants to use their domain at
blog.company.com
to point to their blog hosted on your Rails app atmyapp.com/blogs/:id
.
I clip this down for use in my upcoming page generator. It is based on Rails and will allow custom domain to point to the service.