title: Create 301 redirect that excludes facebook
body: <p>I have a website that I changed from http to https. It has a 301 redirect to make sure everyone goes to the https version. </p>
  
  <p>Unfortunately, that causes Facebook to see it as a different website and reset the share count to zero. In Facebook's developer guide, <a href="https://developers.facebook.com/docs/plugins/faqs#moving-urls" rel="nofollow">they give a solution to this</a>:</p>
  
  <blockquote>
    <p>if your new URL was "https ://example.com/new-url", and the old URL was
    <a href="https://example.com/old-url" rel="nofollow">https://example.com/old-url</a>, you should include this snippit in the
    new-url:</p>
    
    <p>meta property="og:url" content="https://example.com/old-url" /</p>
  </blockquote>
  
  <p>HOWEVER, the fact that I have a 301 redirect on the site makes this not work. Facebook's crawler never reaches the http site. Here's what Facebook says about that:</p>
  
  <blockquote>
    <p>If you want other clients to redirect when they visit the URL, you
    must send your 301 HTTP response to all non-Facebook crawler clients.</p>
  </blockquote>
  
  <p>Does anyone have an idea how to do that? I can edit my .htaccess file. But what I can I put in there that would accomplish this?</p>
  
  <p>Thank you!</p>
  
  <p>EDIT: My current .htaccess file is simply:</p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  </code></pre>