# Aliasing customer.mysite.com to customer.com possible?

**URL:** <https://www.ruby-forum.com/t/aliasing-customer-mysite-com-to-customer-com-possible/123000>\
**Category:** Rails\
**Created:** [December 13, 2007, 10:24am UTC](https://www.ruby-forum.com/t/aliasing-customer-mysite-com-to-customer-com-possible/123000 "2007-12-13T10:24:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![adistarmid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adistarmid](https://www.ruby-forum.com/u/adistarmid)\
**Post date:** [December 13, 2007, 10:24am UTC](https://www.ruby-forum.com/t/aliasing-customer-mysite-com-to-customer-com-possible/123000/1 "2007-12-13T10:24:59Z")

</div>

I’m using DHH’s Account Location plugin to create the subdomains for the  
users. If a user wants a unique domain name for their account (e.g.  
[customer.com](http://customer.com)), instead of the default [customer.mysite.com](http://customer.mysite.com), is that  
possible?

Any ideas or resources on where to start?

---

<div class="post-metadata">

**Author:** ![adistarmid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adistarmid](https://www.ruby-forum.com/u/adistarmid)\
**Post date:** [December 13, 2007, 10:40am UTC](https://www.ruby-forum.com/t/aliasing-customer-mysite-com-to-customer-com-possible/123000/2 "2007-12-13T10:40:57Z")

</div>

On Dec 13, 2007, at 1:24 AM, Bob S. wrote:

> I’m using DHH’s Account Location plugin to create the subdomains  
> for the  
> users. If a user wants a unique domain name for their account (e.g.  
> [customer.com](http://customer.com)), instead of the default [customer.mysite.com](http://customer.mysite.com), is that  
> possible?

Someone (presumably your customer) would have to buy that domain  
name, and someone would have to host the DNS records for it to point  
that domain name to your server’s IP address. Your HTTP server’s  
virtual host config would then have to allow for aliasing of the  
customer’s domain to your application.

It is doable. I would ony know how to do it manually (for Apache),  
and the HTTP server would have to be bounced each time you added an  
alias. It’s not something I would want to offer as a feature for  
everyone in a shared application as I don’t see an easy way to  
automate it, but someone out there may have dealt with it.

Sounds like you’re set on the sub-domains, but in case anyone else  
was wondering, here’s more info on subdomain how-to http://  
www.railsdev.ws/blog/10/using-subdomains-in-rails-apps/

–  
def gw  
acts\_as\_n00b  
writes\_at(www.railsdev.ws)  
end

---

<div class="post-metadata">

**Author:** ![adistarmid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adistarmid](https://www.ruby-forum.com/u/adistarmid)\
**Post date:** [December 13, 2007, 10:45am UTC](https://www.ruby-forum.com/t/aliasing-customer-mysite-com-to-customer-com-possible/123000/3 "2007-12-13T10:45:32Z")

</div>

Thanks for the great info, Greg! I had a hunch that automating it  
wouldn’t be possible. I know Ning offers domain aliasing for their  
users, and I’m assuming they manually do it for each customer (or have  
the customer do it).

I just located Shopify’s domain aliasing process for GoDaddy users  
([http://wiki.shopify.com/Godaddy](http://wiki.shopify.com/Godaddy)). Pretty tedious!

---

<div class="post-metadata">

**Author:** ![adistarmid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adistarmid](https://www.ruby-forum.com/u/adistarmid)\
**Post date:** [December 13, 2007, 10:52am UTC](https://www.ruby-forum.com/t/aliasing-customer-mysite-com-to-customer-com-possible/123000/4 "2007-12-13T10:52:41Z")

</div>

On 13 Dec 2007, at 10:40, Greg W. wrote:

> customer’s domain to your application.
> 
> It is doable. I would ony know how to do it manually (for Apache),  
> and the HTTP server would have to be bounced each time you added an  
> alias. It’s not something I would want to offer as a feature for  
> everyone in a shared application as I don’t see an easy way to  
> automate it, but someone out there may have dealt with it.

Greg is right here, there’s some manual configuration work involved  
such as pointing the dns records and adding a ServerAlias directive  
to Apache (the reload the apache configs). After that, u can use the  
“account\_domain” helper of the account location plugin to check  
against that domain:

account\_domain==“[maindomain.com](http://maindomain.com)” ? Account.find\_by\_subdomain :  
Account.find\_by\_domain

Best regards

Peter De Berdt

---

<div class="post-metadata">

**Author:** ![adistarmid](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f14d63/32.png) [@adistarmid](https://www.ruby-forum.com/u/adistarmid)\
**Post date:** [December 13, 2007, 11:05am UTC](https://www.ruby-forum.com/t/aliasing-customer-mysite-com-to-customer-com-possible/123000/5 "2007-12-13T11:05:43Z")

</div>

Peter De Berdt wrote:

> On 13 Dec 2007, at 10:40, Greg W. wrote:
> 
> > customer’s domain to your application.
> > 
> > It is doable. I would ony know how to do it manually (for Apache),  
> > and the HTTP server would have to be bounced each time you added an  
> > alias. It’s not something I would want to offer as a feature for  
> > everyone in a shared application as I don’t see an easy way to  
> > automate it, but someone out there may have dealt with it.
> 
> Greg is right here, there’s some manual configuration work involved  
> such as pointing the dns records and adding a ServerAlias directive  
> to Apache (the reload the apache configs). After that, u can use the  
> “account\_domain” helper of the account location plugin to check  
> against that domain:
> 
> account\_domain==“[maindomain.com](http://maindomain.com)” ? Account.find\_by\_subdomain :  
> Account.find\_by\_domain
> 
> Best regards
> 
> Peter De Berdt

Great stuff, Peter. Thanks for the dns and apache tips – and,  
especially that last one involving the account location plugin that’s  
going to save me a lot of time figuring all of this out. Thanks a bunch!
