title: Modifying CDN Migration Paths
body: <p>I'm trying to migrate a CDN from rackspace to aws.  </p>
  
  <p>In the former, everything is mapped to individual containers via CNAME records like so: </p>
  
  <pre><code>container1  =   CNAME   =   container1.cdndomain
  container2  =   CNAME   =   container2.cdndomain
  container3  =   CNAME   =   container3.cdndomain
  </code></pre>
  
  <p>When we set up aws, everything I read said to set up one (only) cloudfront, with various buckets.  So that's what I did. </p>
  
  <p>Now I'm trying to somehow remap all of those containers into their new aws home and corresponding 'buckets' but the single cloudfront is making it hard for me.   </p>
  
  <p>I'd rather not go through thousands of line of code and config files and change all the current urls (e.g. manually change container1.cdndomain to cdndomain/container1). </p>
  
  <p>But I can't find a way to remap</p>
  
  <pre><code>this:  http://bgimgs.cdndomain/image
  </code></pre>
  
  <p>To it's aws counterpart</p>
  
  <pre><code>here:   http://cdndomain/bucket/image
  </code></pre>
  
  <p>We use Zerigo for DNS and the interface will accept this CNAME path: </p>
  
  <pre><code>container.domain  =  CNAME = cdndomain/bucket
  </code></pre>
  
  <p>but aws doesn't route that to the correct bucket. </p>
  
  <p>I've tried an .htaccess solution</p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{HTTP_HOST} ^container1\.cdndomain(.*)$ [NC]
  RewriteRule ^(.*)$ http:\/\/cdndomain/container1/$1 [L,R=301]
  </code></pre>
  
  <p>But that's not working either.  </p>
  
  <p>Any ideas? </p>