MCNi Wiki : Configuring alternate domains per site

Musicians are dumb. Often, they will sign up for a hosting service before they've even registered a domain name. Sometimes they'll do it before they've even picked the name of the project. And then they'll register their domain name through GoDaddy, which doesn't support URL redirects.

When that happens, they'll invariably come to us asking us to update their domain name. Here's how we do that for now.

For examples. We'll assume that the band signed up as myband.com (myband.bombplates.com) but ended up registering mybandmusic.com instead

  1. Shell into the server hosting their site.
  2. Edit the sites vhosts file /media/data/conf.d/sites/myband.bombplates.com.conf (as root)
  3. Add the new domain(s) to the end of the ServerAlias line (including the www. version)
  4. Copy the RewriteCond/RewriteRule couplet; use the new domain. Alternatively, you may set the rewrite to redirect to whichever domain the user plans on listing in search engines
    e.g.
    RewriteCond %{HTTP_HOST}  ^(www.)?mybandaltdomain.(com|net)$ [NC]
    RewriteRule ^(.*)$ http://www.myband.com$1 [L,R=301]
  5. If necessary, standardize the whole vhosts file
    RewriteCond %{HTTP_HOST} ^myband.com$ [NC]
    RewriteRule ^(.*)$ http://www.myband.com$1 [L,R=301]

    RewriteCond %{HTTP_HOST} ^(www.)?mybandmusic.com$ [NC]
    RewriteRule ^(.*)$ http://www.myband.com$1 [L,R=301]

    <VirtualHost *:80>
      ServerAdmin info@myband.bombplates.com
      DocumentRoot /var/www/html
      ServerName myband.bombplates.com
      ServerAlias myband.com www.myband.com mybandmusic.com www.mybandmusic.com
      RewriteEnginge On
      RewriteOptions inherit
    </VirtualHost>

  6. Add a symlink for the new domain
    # cd /var/www/html/sites
    # ln -s myband.bombplates.com www.mybandmusic.com
  7. Restart httpd
  8. Update /var/www/include/this_node/sites.php to whitelist the new domain for reCAPTCHA
    $all_sites['myband.bombplates.com'] = 'http://www.myband.com';
    $all_sites['www.mybandmusic.com'] = 'http://myband.bombplates.com';
  9. It may take a few minutes for caches to clear

Here are the existing alternate domain names

Current

ServerAlias amandawintercountry.com www.amandawintercountry.com amandawintermusic.com www.amandawintermusic.com
 ServerAlias anacristina.com www.anacristina.com anachristina.com www.anachristina.com
 ServerAlias austinwebbmusic.com www.austinwebbmusic.com austinwebb.com www.austinwebb.com
 ServerAlias cherryholmes.com cherryholmes.tv www.cherryholmes.tv cherryholmes.us www.cherryholmes.us cherryholmes.net www.cherryholmes.net cherryholmes.biz www.cherryholmes.biz cherryholmesfamilyband.com www.cherryholmesfamilyband.com
 ServerAlias davidandwhitneymusic.com daveandwhitney.com www.daveandwhitney.com  ServerAlias elizabethlyons.com elizabethlyonsmusic.com www.elizabethlyonsmusic.com ServerAlias emilywestmusic.com emilywestofficial.com www.emilywestofficial.com  ServerAlias jungyouthmusic.com jungyouth.com www.jungyouth.com  ServerAlias localhoneyvintage.com lhnashville.com www.lhnashville.com
 ServerAlias openthecage.com openthecagegear.com www.openthecagegear.com michaelconnorsmusic.com  www.michaelconnorsmusic.com
 ServerAlias rachelmorganperry.com everettrae.com www.everettrae.com everythingeverett.com www.everythingeverett.com  ServerAlias smokingpopesmusic.com www.smokingpopes.net smokingpopes.net  ServerAlias teammartina.com teammusicislove.com www.teammusicislove.com
 ServerAlias trickpony.com theponiesmusic.com www.theponiesmusic.com ServerAlias whitneyduncanmusic.com whitneyduncan.com www.whitneyduncan.com ServerAlias bgmetalsinc.com www.bgmetalsinc.com bgmetals.com www.bgmetals.com ServerAlias savannahleemusic.com savannahbrymer.com www.savannahbrymer.com ServerAlias mallaryhope.com www.mallaryhope.com mallaryhopemusic.com www.mallaryhopemusic.com

Defunct (only on bands2/bands 3)

 ServerAlias ejswanson.com www.ejswanson.org ejswanson.org
 ServerAlias emilywestmusic.com emilywestofficial.com www.emilywestofficial.com
 ServerAlias blackfootgypsies.com theblackfootgypsies.com www.theblackfootgypsies.com
 ServerAlias whitneyduncanmusic.com whitneyduncan.com www.whitneyduncan.com
 ServerAlias www.westonjamesmusic.com ServerAlias www.janinestange.com
 ServerAlias www.peopleonahill.com
 ServerAlias www.fourtwelvemusic.com
 ServerAlias www.davidashleyonline.com
 ServerAlias wherethepartyat.com erikdylanmusic.com www.wherethepartyat.com
 ServerAlias zachdylancountry.com zachdylan.net www.zachdylan.net

TODO: eventually, we should find a way to automate this. (e.g. we could set up a domain server that points WHATEVER.TLD to www.WHATEVER.TLD)