title: CloudFront-powered website is redirected to s3 bucket url
body: <p>I've got a static-hosting enable S3 bucket. There's also a cloudfront distribution that is being powered by that bucket.</p>
  
  <p>I've added a CNAME entry to the cloudfront distribution for "mywebsite.com"</p>
  
  <p>and when I go to load "mywebsite.com" in my browser, it redirects to <code>http://my-bucket.s3-us-west-2.amazonaws.com/index.html</code></p>
  
  <p>Why is this redirect happening? how do I stop that hostname from being rewritten?</p>
  
  <p><strong>Edit: here's the setup details after some suggested changes:</strong></p>
  
  <ul>
  <li><strong>cloudfront</strong> - <strong><em>alternate domain</em></strong>: mysite.com</li>
  <li><strong>cloudfront</strong> - <strong><em>alternate domain</em></strong>: www.mysite.com</li>
  <li><strong>cloudfront</strong> - <strong><em>origin</em></strong>: my-bucket.s3-website-us-west-2.amazonaws.com</li>
  <li><strong>route53</strong> - <strong><em>hosted zone</em></strong>: mysite.com</li>
  <li><strong>route53</strong> - <strong><em>A record</em></strong>: 12345.cloudfront.net</li>
  <li><strong>route53</strong> - <strong><em>CNAME</em></strong>: www.mysite.com --> mysite.com</li>
  </ul>
  
  <p><strong>and the effects of this setup:</strong></p>
  
  <ul>
  <li>Loading: <code>mysite.com</code> --> 301 redirects to <code>my-bucket.s3-website-us-west-2.amazonaws.com</code></li>
  <li>Loading: <code>www.mysite.com</code> --> 301 redirects to <code>my-bucket.s3-website-us-west-2.amazonaws.com</code></li>
  <li>Loading: <code>my-bucket.s3-website-us-west-2.amazonaws.com</code> --> 200 Success</li>
  <li>Loading: <code>d1h3yk3zemxpnb.cloudfront.net</code> --> 301 redirects to <code>my-bucket.s3-website-us-west-2.amazonaws.com</code></li>
  <li>Loading: <code>http://my-bucket.s3.amazonaws.com/</code> --> permissions error</li>
  </ul>