title: Curl: (51) error when trying to check whether or not my website redirects correctly
body: <p>When I try to make up a <code>.htaccess</code> file to redirect my www to non-www, I get some issues.</p>
  
  <pre><code>RewriteEngine On
  RewriteBase /
  RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
  RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
  </code></pre>
  
  <p>This is the <code>.htaccess</code> file I've used, after using: <code>curl -I https://www</code> I get:</p>
  
  <blockquote>
    <p>curl: (51) Unable to communicate securely with peer: requested domain name does not match the server's certificate.</p>
  </blockquote>
  
  <p>But after using <code>curl -I http://www</code> I get a 301 redirection, which was my intended case but it redirects to HTTPS www.</p>
  
  <p>The problem of that is that I get a DNS error when I'm visiting it on the internet. </p>
  
  <p>How can I possibly fix this?</p>